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 a88e449
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions scripts/genmod/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module genmod
require (
github.com/pkg/errors v0.9.1
go.elastic.co/apm/v2 v2.1.0
golang.org/x/mod v0.5.1
)

replace go.elastic.co/apm/v2 => ../..
Expand Down
2 changes: 0 additions & 2 deletions scripts/genmod/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/prometheus/procfs v0.0.0-20190425082905-87a4384529e0/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU=
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/santhosh-tekuri/jsonschema v1.2.4 h1:hNhW8e7t+H1vgY+1QeEQpveR6D4+OwKPXCfD2aieJis=
github.com/santhosh-tekuri/jsonschema v1.2.4/go.mod h1:TEAUOeZSmIxTTuHatJzrvARHiuO9LYd+cIxzgEHCQI4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
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 a88e449

Please sign in to comment.