Skip to content

Commit be26aa7

Browse files
committed
cmd/go: make cfg.BuildContext.ToolTags same order with build.Default.ToolTags
So it's consistent when running "go list -f '{{context.ToolTags}}'" and printing the content of "build.Default.ToolTags". Updates #45454 Change-Id: I7a3cbf3cdf9a6ce2b8c89e9bcf5fc5e9086d48e8 Reviewed-on: https://go-review.googlesource.com/c/go/+/422615 Reviewed-by: Bryan Mills <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Cuong Manh Le <[email protected]>
1 parent 535fe2b commit be26aa7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/cmd/go/internal/cfg/cfg.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,12 @@ func init() {
237237
CleanGOEXPERIMENT = Experiment.String()
238238

239239
// Add build tags based on the experiments in effect.
240-
for _, exp := range Experiment.Enabled() {
241-
BuildContext.ToolTags = append(BuildContext.ToolTags, "goexperiment."+exp)
240+
exps := Experiment.Enabled()
241+
expTags := make([]string, 0, len(exps)+len(BuildContext.ToolTags))
242+
for _, exp := range exps {
243+
expTags = append(expTags, "goexperiment."+exp)
242244
}
245+
BuildContext.ToolTags = append(expTags, BuildContext.ToolTags...)
243246
}
244247

245248
// An EnvVar is an environment variable Name=Value.

0 commit comments

Comments
 (0)