Skip to content

Commit

Permalink
fix: if a go version is specified we should use that and not determin…
Browse files Browse the repository at this point in the history
…e the version from the build environment (#31)

Signed-off-by: James Rawlings <[email protected]>
  • Loading branch information
rawlingsj authored Mar 15, 2024
1 parent 2f9a35d commit c096bb3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/update/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,14 @@ func checkPackageValues(pkgVersions map[string]*types.Package, modFile *modfile.
}

func DoUpdate(pkgVersions map[string]*types.Package, cfg *types.Config) (*modfile.File, error) {
goVersion, err := getGoVersionFromEnvironment()
if err != nil {
return nil, fmt.Errorf("failed to get the go version from the local system: %v", err)
var err error
goVersion := cfg.GoVersion
if goVersion == "" {
if goVersion, err = getGoVersionFromEnvironment(); err != nil {
return nil, fmt.Errorf("failed to get the Go version from the local system: %v", err)
}
}

// Run go mod tidy before
if cfg.Tidy {
output, err := run.GoModTidy(cfg.Modroot, goVersion, cfg.TidyCompat)
Expand Down

0 comments on commit c096bb3

Please sign in to comment.