Skip to content

Commit 989335f

Browse files
authored
fix golang testdata (#577)
## Summary These gave errors like: ``` expected version: go1.17, got: go1.17.13 ``` when doing `go run main.go` in their respective `devbox shell` ## How was it tested? opened a `devbox shell` and did `go run main.go` and got the version printed out without any panic
1 parent 4b85f85 commit 989335f

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

examples/testdata/go/go-1.17/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ package main
33
import (
44
"fmt"
55
"runtime"
6+
"strings"
67
)
78

89
func main() {
910
expected := "go1.17"
1011
goVersion := runtime.Version()
1112
fmt.Printf("Go version: %s\n", goVersion)
12-
if goVersion != expected {
13+
if !strings.HasPrefix(goVersion, expected) {
1314
panic(fmt.Errorf("expected version: %s, got: %s", expected, goVersion))
1415
}
1516
}

examples/testdata/go/go-1.18/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ package main
33
import (
44
"fmt"
55
"runtime"
6+
"strings"
67
)
78

89
func main() {
910
expected := "go1.18"
1011
goVersion := runtime.Version()
1112
fmt.Printf("Go version: %s\n", goVersion)
12-
if goVersion != expected {
13+
if !strings.HasPrefix(goVersion, expected) {
1314
panic(fmt.Errorf("expected version: %s, got: %s", expected, goVersion))
1415
}
1516
}

examples/testdata/go/go-1.19/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ package main
33
import (
44
"fmt"
55
"runtime"
6+
"strings"
67
)
78

89
func main() {
910
expected := "go1.19"
1011
goVersion := runtime.Version()
1112
fmt.Printf("Go version: %s\n", goVersion)
12-
if goVersion != expected {
13+
if !strings.HasPrefix(goVersion, expected) {
1314
panic(fmt.Errorf("expected version: %s, got: %s", expected, goVersion))
1415
}
1516
}

0 commit comments

Comments
 (0)