File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,7 +130,13 @@ func parseGoVersion(data string) string {
130130 for sc .Scan () {
131131 lastLine = sc .Text ()
132132 }
133- return strings .Fields (lastLine )[2 ]
133+
134+ var goVersion = strings .Fields (lastLine )[2 ]
135+
136+ // Drop custom build suffixes.
137+ goVersion , _ , _ = strings .Cut (goVersion , "-" )
138+
139+ return goVersion
134140}
135141
136142// Returns a value indicating whether the system Go toolchain supports workspaces.
Original file line number Diff line number Diff line change 88
99func TestParseGoVersion (t * testing.T ) {
1010 tests := map [string ]string {
11- "go version go1.18.9 linux/amd64" : "go1.18.9" ,
11+ "go version go1.18.9 linux/amd64" : "go1.18.9" ,
12+ "go version go1.26.3-X:nodwarf5 linux/amd64" : "go1.26.3" ,
13+ "go version go1.26.3rc1 linux/amd64" : "go1.26.3rc1" ,
1214 "warning: GOPATH set to GOROOT (/usr/local/go) has no effect\n go version go1.18.9 linux/amd64" : "go1.18.9" ,
1315 }
1416 for input , expected := range tests {
You can’t perform that action at this time.
0 commit comments