Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
Fix lint issue due to too many calls to same data
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisWiegman committed Sep 30, 2023
1 parent 495b377 commit b850cd6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/settings/ssl.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (

var execCommand = exec.Command

const certOS = "darwin"

// EnsureSSLCerts Ensures SSL certificates have been generated and are where they need to be.
func (s *Settings) EnsureSSLCerts(consoleOutput *console.Console) error {
createCert := false
Expand Down Expand Up @@ -47,15 +49,15 @@ func (s *Settings) EnsureSSLCerts(consoleOutput *console.Console) error {
}

// If we're on Mac try to add the cert to the system trust.
if s.SSL && runtime.GOOS == "darwin" {
if s.SSL && runtime.GOOS == certOS {
return TrustSSL(consoleOutput)
}

return nil
}

func TrustSSL(consoleOutput *console.Console) error {
if runtime.GOOS != "darwin" {
if runtime.GOOS != certOS {
return fmt.Errorf("the trust command is only available for MacOS")
}
err := VerifySSLTrust()
Expand All @@ -80,7 +82,7 @@ func TrustSSL(consoleOutput *console.Console) error {
}

func VerifySSLTrust() error {
if runtime.GOOS == "darwin" {
if runtime.GOOS == certOS {
verifyCertCommand := execCommand(
"security",
"find-certificate",
Expand Down

0 comments on commit b850cd6

Please sign in to comment.