From 086357e8f617c325339fdaedd13563dbdb05b00d Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Fri, 12 Mar 2021 11:21:38 -0500 Subject: [PATCH] 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 Run-TryBot: Cherry Zhang Reviewed-by: Bryan C. Mills TryBot-Result: Go Bot --- src/cmd/go/internal/work/exec.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go index bd5ae467393..fd3d3e03bb9 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go @@ -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) }