Skip to content

Commit fa34678

Browse files
committed
internal/buildcfg: change GOEXPERIMENT to always return non-empty string
Rather than returning "", we now return "," (which is a no-op). This ensures that the returned string always overrides DefaultGOEXPERIMENT. This fixes a bootstrapping issue where GOROOT_BOOTSTRAP was built with "GOEXPERIMENT=fieldtrack ./make.bash". cmd/dist sets GOEXPERIMENT=none during bootstrapping, which was causing cmd/go to set GOEXPERIMENT="" when executing cmd/compile; but then cmd/compile ignores the environment variable (because it's empty) and instead uses DefaultGOEXPERIMENT. Fixes #47921. Change-Id: I657ff6cdfb294a94f6a2f58c306ceed7f104416b Reviewed-on: https://go-review.googlesource.com/c/go/+/344511 Run-TryBot: Matthew Dempsky <[email protected]> TryBot-Result: Go Bot <[email protected]> Trust: Matthew Dempsky <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]>
1 parent 0a7f00a commit fa34678

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/internal/buildcfg/exp.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,11 @@ func expList(exp, base *goexperiment.Flags, all bool) []string {
158158
// GOEXPERIMENT is exactly what a user would set on the command line
159159
// to get the set of enabled experiments.
160160
func GOEXPERIMENT() string {
161-
return strings.Join(expList(&Experiment, &experimentBaseline, false), ",")
161+
goexp := strings.Join(expList(&Experiment, &experimentBaseline, false), ",")
162+
if goexp == "" && DefaultGOEXPERIMENT != "" {
163+
goexp = "," // non-empty to override DefaultGOEXPERIMENT
164+
}
165+
return goexp
162166
}
163167

164168
// EnabledExperiments returns a list of enabled experiments, as

0 commit comments

Comments
 (0)