aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/cfg/cfg.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2021-06-25 13:24:10 -0700
committerMatthew Dempsky <mdempsky@google.com>2021-06-27 05:06:30 +0000
commitc95464f0ea3f87232b1f3937d1b37da6f335f336 (patch)
tree2bd7a24f7f2d40506bdbe729041f1afe094be5a2 /src/cmd/go/internal/cfg/cfg.go
parented01ceaf4838cd67fd802df481769fa9ae9d0440 (diff)
downloadgo-c95464f0ea3f87232b1f3937d1b37da6f335f336.tar.gz
go-c95464f0ea3f87232b1f3937d1b37da6f335f336.zip
internal/buildcfg: refactor GOEXPERIMENT parsing code somewhat
This CL extracts out a ParseGOEXPERIMENT helper function that parses GOOS/GOARCH/GOEXPERIMENT values and returns active and baseline experiment flag sets and an error value, without affecting any global state. This will be used in the subsequent CL for 'go env' support for GOEXPERIMENT to validate configuration changes. The existing package initialization for Experiment and experimentBaseline and also UpdateExperiments are updated to use it as well. Change-Id: Ic2ed3fd36d2a6f7f3d8172fccb865e02505c0052 Reviewed-on: https://go-review.googlesource.com/c/go/+/331109 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/go/internal/cfg/cfg.go')
-rw-r--r--src/cmd/go/internal/cfg/cfg.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go
index fc6989097e..57a3c1ff6f 100644
--- a/src/cmd/go/internal/cfg/cfg.go
+++ b/src/cmd/go/internal/cfg/cfg.go
@@ -79,7 +79,7 @@ func defaultContext() build.Context {
// The experiments flags are based on GOARCH, so they may
// need to change. TODO: This should be cleaned up.
- buildcfg.UpdateExperiments(ctxt.GOARCH)
+ buildcfg.UpdateExperiments(ctxt.GOOS, ctxt.GOARCH, envOr("GOEXPERIMENT", buildcfg.DefaultGOEXPERIMENT))
ctxt.ToolTags = nil
for _, exp := range buildcfg.EnabledExperiments() {
ctxt.ToolTags = append(ctxt.ToolTags, "goexperiment."+exp)