aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2022-08-10 22:52:58 +0700
committerCuong Manh Le <cuong.manhle.vn@gmail.com>2022-09-05 04:17:02 +0000
commitbe26aa70d432572599d185492f5e2b095d75cc4d (patch)
tree353c74f699bab0e4ad983fb3124fb498eba83fe9 /src
parent535fe2b226096a3547321a51b36f464ab443b5cb (diff)
downloadgo-be26aa70d432572599d185492f5e2b095d75cc4d.tar.xz
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 <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/go/internal/cfg/cfg.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go
index 7fb75db5f7..2a1475ef2e 100644
--- a/src/cmd/go/internal/cfg/cfg.go
+++ b/src/cmd/go/internal/cfg/cfg.go
@@ -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.