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>
main
Brad Fitzpatrick 1 month ago committed by Brad Fitzpatrick
parent bd2a2d53d3
commit e400d5aa7b
  1. 7
      cmd/testwrapper/testwrapper_test.go

@ -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"

Loading…
Cancel
Save