From: Austin Clements Date: Wed, 17 May 2023 19:10:51 +0000 (-0400) Subject: cmd/dist: don't pass -linkmode=auto X-Git-Tag: go1.21rc1~440 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=408f7a4663fdb19357e2c0967eb442a1e5679b2d;p=gostls13.git cmd/dist: don't pass -linkmode=auto This is the default value of this flag, so passing it clutters up debugging output. This also makes it clearer which tests are running with a default configuration. Change-Id: If793934829c79f087c7a6e3fa8f64dc33959c213 Reviewed-on: https://go-review.googlesource.com/c/go/+/496176 Reviewed-by: Dmitri Shuralyov Run-TryBot: Austin Clements Reviewed-by: Bryan Mills TryBot-Result: Gopher Robot --- diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go index 132542cde1..fe818036b5 100644 --- a/src/cmd/dist/test.go +++ b/src/cmd/dist/test.go @@ -1096,7 +1096,11 @@ func (t *tester) registerCgoTests(heading string) { variant: variant, pkg: "cmd/cgo/internal/" + subdir, buildmode: buildmode, - ldflags: "-linkmode=" + linkmode, + } + var ldflags []string + if linkmode != "auto" { + // "auto" is the default, so avoid cluttering the command line for "auto" + ldflags = append(ldflags, "-linkmode="+linkmode) } if linkmode == "internal" { @@ -1110,7 +1114,7 @@ func (t *tester) registerCgoTests(heading string) { // cgoTest we want static linking. gt.buildmode = "" if linkmode == "external" { - gt.ldflags += ` -extldflags "-static -pthread"` + ldflags = append(ldflags, `-extldflags "-static -pthread"`) } else if linkmode == "auto" { gt.env = append(gt.env, "CGO_LDFLAGS=-static -pthread") } else { @@ -1118,6 +1122,7 @@ func (t *tester) registerCgoTests(heading string) { } gt.tags = append(gt.tags, "static") } + gt.ldflags = strings.Join(ldflags, " ") t.registerTest("cgo:"+subdir+":"+variant, heading, gt, opts...) return gt