diff options
| author | Austin Clements <austin@google.com> | 2021-04-14 13:25:31 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2021-04-16 03:16:55 +0000 |
| commit | d26fc68aa10dc8eda5ccdcc80d790e7df2fd9823 (patch) | |
| tree | 13fa355e29d55de5b536f56fa85e4073a0a00025 /src/cmd/internal/objabi/flag.go | |
| parent | cf2396c70e7213570c69ca155203c25c960cc10c (diff) | |
| download | go-d26fc68aa10dc8eda5ccdcc80d790e7df2fd9823.tar.xz | |
cmd/internal/objabi,test: use correct GOEXPERIMENT build tags in test/run.go
Currently, run.go sets GOEXPERIMENT build tags based on the
*difference* from the baseline experiment configuration, rather than
the absolute experiment configuration. This differs from cmd/go. As a
result, if we set a baseline configuration and don't override it with
a GOEXPERIMENT setting, run.go won't set any GOEXPERIMENT build tags,
instead of setting the tags corresponding to the baseline
configuration.
Fix this by making compile -V=goexperiment produce the full
GOEXPERIMENT configuration, which run.go can then use to set exactly
the right set of build tags.
For #40724.
Change-Id: Ieda6ea62f1a1fabbe8d749d6d09c198fd5ca8377
Reviewed-on: https://go-review.googlesource.com/c/go/+/310171
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/internal/objabi/flag.go')
| -rw-r--r-- | src/cmd/internal/objabi/flag.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/cmd/internal/objabi/flag.go b/src/cmd/internal/objabi/flag.go index 6a8a69116d..9fcab4cc85 100644 --- a/src/cmd/internal/objabi/flag.go +++ b/src/cmd/internal/objabi/flag.go @@ -93,10 +93,16 @@ func (versionFlag) Set(s string) error { p := "" - // If the enabled experiments differ from the defaults, - // include that difference. - if goexperiment := GOEXPERIMENT(); goexperiment != "" { - p = " X:" + goexperiment + if s == "goexperiment" { + // test/run.go uses this to discover the full set of + // experiment tags. Report everything. + p = " X:" + strings.Join(expList(&Experiment, nil, true), ",") + } else { + // If the enabled experiments differ from the defaults, + // include that difference. + if goexperiment := GOEXPERIMENT(); goexperiment != "" { + p = " X:" + goexperiment + } } // The go command invokes -V=full to get a unique identifier |
