File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,15 @@ func getEnvGoSemVer() string {
96
96
if ! strings .HasPrefix (goVersion , "go" ) {
97
97
log .Fatalf ("Expected 'go version' output of the form 'go1.2.3'; got '%s'" , goVersion )
98
98
}
99
- return "v" + goVersion [2 :]
99
+ // Go versions don't follow the SemVer format, but the only exception we normally care about
100
+ // is release candidates; so this is a horrible hack to convert e.g. `go1.22rc1` into `go1.22-rc1`
101
+ // which is compatible with the SemVer specification
102
+ rcIndex := strings .Index (goVersion , "rc" )
103
+ if rcIndex != - 1 {
104
+ return semver .Canonical ("v" + goVersion [2 :rcIndex ]) + "-" + goVersion [rcIndex :]
105
+ } else {
106
+ return semver .Canonical ("v" + goVersion [2 :])
107
+ }
100
108
}
101
109
102
110
// Returns the import path of the package being built, or "" if it cannot be determined.
You can’t perform that action at this time.
0 commit comments