File tree 2 files changed +9
-1
lines changed
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -132,5 +132,10 @@ func (ver semVer) MajorMinor() SemVer {
132
132
}
133
133
134
134
func (ver semVer ) StandardSemVer () string {
135
- return string (ver )[1 :]
135
+ // Drop the 'v' prefix from the version string.
136
+ result := string (ver )[1 :]
137
+
138
+ // Correct the pre-release identifier for use with `setup-go`, if one is present.
139
+ // This still remains a standard semantic version.
140
+ return strings .Replace (result , "-rc" , "-rc." , 1 )
136
141
}
Original file line number Diff line number Diff line change 1
1
package util
2
2
3
3
import (
4
+ "strings"
4
5
"testing"
5
6
6
7
"golang.org/x/mod/semver"
@@ -52,6 +53,8 @@ func TestNewSemVer(t *testing.T) {
52
53
result ,
53
54
)
54
55
}
56
+
57
+ expected = strings .Replace (expected , "-rc1" , "-rc.1" , 1 )
55
58
if result .StandardSemVer () != expected [1 :] {
56
59
t .Errorf (
57
60
"Expected NewSemVer(\" %s\" ).StandardSemVer() to return \" %s\" , but got \" %s\" ." ,
You can’t perform that action at this time.
0 commit comments