mirror of
https://github.com/tailscale/tailscale.git
synced 2026-03-26 02:03:42 -04:00
cmd/testwrapper: make test tolerant of a GOEXPERIMENT being set
Otherwise it generates an syntactically invalid go.mod file and subsequently fails. Updates #18884 Change-Id: I1a0ea17a57b2a37bde3770187e1a6e2d8aa55bfe Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
bd2a2d53d3
commit
e400d5aa7b
@@ -220,11 +220,14 @@ func TestCached(t *testing.T) {
|
||||
|
||||
// Construct our trivial package.
|
||||
pkgDir := t.TempDir()
|
||||
goVersion := runtime.Version()
|
||||
goVersion = strings.TrimPrefix(goVersion, "go")
|
||||
goVersion, _, _ = strings.Cut(goVersion, "-X:") // map 1.26.1-X:nogreenteagc to 1.26.1
|
||||
|
||||
goMod := fmt.Sprintf(`module example.com
|
||||
|
||||
go %s
|
||||
`, runtime.Version()[2:]) // strip leading "go"
|
||||
|
||||
`, goVersion)
|
||||
test := `package main
|
||||
import "testing"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user