Skip to content

Commit c5c05a0

Browse files
committed
cmd/go: add test checking version with experiment is valid
For #75953 Change-Id: I6a6a69645d6d2af9be1b076f2460cdb295ea3c6e Reviewed-on: https://go-review.googlesource.com/c/go/+/720600 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
1 parent f22d37d commit c5c05a0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/cmd/go/testdata/script/version_goexperiment.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,13 @@ stderr 'X:fieldtrack$'
1212

1313
-- version.go --
1414
package main
15-
import "runtime"
16-
func main() { println(runtime.Version()) }
15+
import (
16+
"go/version"
17+
"runtime"
18+
)
19+
func main() {
20+
if !version.IsValid(runtime.Version()) {
21+
panic("version not valid: "+runtime.Version())
22+
}
23+
println(runtime.Version())
24+
}

0 commit comments

Comments
 (0)