From: Cherry Zhang Date: Sun, 11 Apr 2021 17:26:44 +0000 (-0400) Subject: test: consider default GOEXPERIMENT when matching build tags X-Git-Tag: go1.17beta1~719 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9ed0e32059;p=gostls13.git test: consider default GOEXPERIMENT when matching build tags If GOEXPERIMENT environment variable is unset, use the default value that is baked into the toolchain (instead of no experiments). Change-Id: I41f863e6f7439f2d53e3ebd25a7d9cf4a176e32e Reviewed-on: https://go-review.googlesource.com/c/go/+/309333 Trust: Cherry Zhang Run-TryBot: Cherry Zhang TryBot-Result: Go Bot Reviewed-by: Than McIntosh --- diff --git a/test/run.go b/test/run.go index 48115ed18d..feab88338c 100644 --- a/test/run.go +++ b/test/run.go @@ -446,6 +446,18 @@ func (ctxt *context) match(name string) bool { } exp := os.Getenv("GOEXPERIMENT") + if exp == "" { + // If GOEXPERIMENT environment variable is unset, get the default value + // that is baked into the toolchain. + cmd := exec.Command(goTool(), "tool", "compile", "-V") + out, err := cmd.CombinedOutput() + if err == nil { + i := bytes.Index(out, []byte("X:")) + if i != -1 { + exp = string(out[i+2:]) + } + } + } if exp != "" { experiments := strings.Split(exp, ",") for _, e := range experiments {