Skip to content

Commit

Permalink
Clean up setting of swiftBinPath
Browse files Browse the repository at this point in the history
  • Loading branch information
cgrindel committed Nov 22, 2022
1 parent 04a5694 commit 7d6e284
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions gazelle/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ type swiftConfig struct {
swiftBinPath string
}

func setStringToPtr(ptr *string, val string) {
*ptr = val
}

func getSwiftConfig(c *config.Config) *swiftConfig {
return c.Exts[swiftConfigName].(*swiftConfig)
}
Expand All @@ -35,16 +31,16 @@ func (*swiftLang) RegisterFlags(fs *flag.FlagSet, cmd string, c *config.Config)
}

func (sl *swiftLang) CheckFlags(fs *flag.FlagSet, c *config.Config) error {
var err error
sc := getSwiftConfig(c)

// TODO(chuck): Add flag so that the client can tell use which Swift to use.

// Find the Swift executable
swiftBinPath, err := swiftbin.FindSwiftBinPath()
sc.swiftBinPath, err = swiftbin.FindSwiftBinPath()
if err != nil {
return err
}
setStringToPtr(&sc.swiftBinPath, swiftBinPath)

// Look for http_archive declarations with Swift declarations.
wkspFilePath := wspace.FindWORKSPACEFile(c.RepoRoot)
Expand Down

0 comments on commit 7d6e284

Please sign in to comment.