Skip to content

Commit

Permalink
cmd/go: make cfg.BuildContext.ToolTags same order with build.Default.…
Browse files Browse the repository at this point in the history
…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]>
  • Loading branch information
cuonglm committed Sep 5, 2022
1 parent 535fe2b commit be26aa7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/cmd/go/internal/cfg/cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,12 @@ func init() {
CleanGOEXPERIMENT = Experiment.String()

// Add build tags based on the experiments in effect.
for _, exp := range Experiment.Enabled() {
BuildContext.ToolTags = append(BuildContext.ToolTags, "goexperiment."+exp)
exps := Experiment.Enabled()
expTags := make([]string, 0, len(exps)+len(BuildContext.ToolTags))
for _, exp := range exps {
expTags = append(expTags, "goexperiment."+exp)
}
BuildContext.ToolTags = append(expTags, BuildContext.ToolTags...)
}

// An EnvVar is an environment variable Name=Value.
Expand Down

0 comments on commit be26aa7

Please sign in to comment.