mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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 <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
51a47b7ff2
commit
9ed0e32059
1 changed files with 12 additions and 0 deletions
12
test/run.go
12
test/run.go
|
|
@ -446,6 +446,18 @@ func (ctxt *context) match(name string) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
exp := os.Getenv("GOEXPERIMENT")
|
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 != "" {
|
if exp != "" {
|
||||||
experiments := strings.Split(exp, ",")
|
experiments := strings.Split(exp, ",")
|
||||||
for _, e := range experiments {
|
for _, e := range experiments {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue