Skip to content

Commit

Permalink
only upgrade go version in genmod, don't downgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
dmathieu committed Apr 26, 2023
1 parent 2c2d789 commit f134a1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require (
github.com/prometheus/procfs v0.7.3 // indirect
github.com/stretchr/testify v1.6.1
go.elastic.co/fastjson v1.1.0
golang.org/x/mod v0.5.1 // indirect
golang.org/x/sys v0.0.0-20220209214540-3681064d5158
golang.org/x/tools v0.1.9
howett.net/plist v1.0.0 // indirect
Expand Down
3 changes: 2 additions & 1 deletion scripts/genmod/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"strings"

"github.com/pkg/errors"
"golang.org/x/mod/semver"

"go.elastic.co/apm/v2"
)
Expand Down Expand Up @@ -138,7 +139,7 @@ func updateModule(dir string, gomod *GoMod, modules map[string]*GoMod) error {
"-require", require.Path + "@" + *versionFlag,
"-replace", require.Path + "=" + relDir,
}
if *goVersionFlag != "" {
if *goVersionFlag != "" && semver.Compare("v"+*goVersionFlag, "v"+gomod.Go) == 1 {
args = append(args, "-go", *goVersionFlag)
}
cmd := exec.Command("go", args...)
Expand Down

0 comments on commit f134a1e

Please sign in to comment.