1
0
mirror of https://github.com/golang/go synced 2024-11-22 20:50:05 -07:00

cmd/go: include default GOEXPERIMENT in build config

Currently, the build config includes GOEXPERIMENT environment
variable if it is not empty, but that doesn't take the default
value (set at make.bash/bat/rc time) into consideration. This
may cause standard library packages appearing stale, as the
build config appears changed.

This CL changes it to use cfg.GOEXPERIMENT variable, which
includes the default value (if it is not overwritten).

May fix regabi and staticlockranking builders.

Change-Id: I242f887167f8e99192010be5c1a046eb88ab0c2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/301269
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
Cherry Zhang 2021-03-12 11:21:38 -05:00
parent 9289c12002
commit 086357e8f6

View File

@ -276,7 +276,7 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID {
key, val := cfg.GetArchEnv()
fmt.Fprintf(h, "%s=%s\n", key, val)
if exp := cfg.Getenv("GOEXPERIMENT"); exp != "" {
if exp := cfg.GOEXPERIMENT; exp != "" {
fmt.Fprintf(h, "GOEXPERIMENT=%q\n", exp)
}
@ -1250,7 +1250,7 @@ func (b *Builder) printLinkerConfig(h io.Writer, p *load.Package) {
key, val := cfg.GetArchEnv()
fmt.Fprintf(h, "%s=%s\n", key, val)
if exp := cfg.Getenv("GOEXPERIMENT"); exp != "" {
if exp := cfg.GOEXPERIMENT; exp != "" {
fmt.Fprintf(h, "GOEXPERIMENT=%q\n", exp)
}