]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: simplify cgo_test
authorAustin Clements <austin@google.com>
Fri, 21 Oct 2022 19:43:54 +0000 (15:43 -0400)
committerAustin Clements <austin@google.com>
Fri, 4 Nov 2022 20:48:00 +0000 (20:48 +0000)
Now that misc/cgo/test doesn't invoke any Go builds itself, we don't
need to use GOFLAGS to thread build flags down into sub-builds.

Preparation for #37486.

Change-Id: I9ecdd215da5c21339cbf76765f8be2190d19539c
Reviewed-on: https://go-review.googlesource.com/c/go/+/447356
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Austin Clements <austin@google.com>

src/cmd/dist/test.go

index 66ebdf92bfc5b689b343b5dc2a45bc68e19afef5..9670ef447fdd5fb0e12a49f58a9cd4cbd4ed9857 100644 (file)
@@ -1170,16 +1170,14 @@ func (t *tester) runHostTest(dir, pkg string) error {
 }
 
 func (t *tester) cgoTest(dt *distTest) error {
-       cmd := t.addCmd(dt, "misc/cgo/test", t.goTest(), ".")
-       setEnv(cmd, "GOFLAGS", "-ldflags=-linkmode=auto")
+       t.addCmd(dt, "misc/cgo/test", t.goTest(), "-ldflags=-linkmode=auto", ".")
 
        // Stub out various buildmode=pie tests  on alpine until 54354 resolved.
        builderName := os.Getenv("GO_BUILDER_NAME")
        disablePIE := strings.HasSuffix(builderName, "-alpine")
 
        if t.internalLink() {
-               cmd := t.addCmd(dt, "misc/cgo/test", t.goTest(), "-tags=internal", ".")
-               setEnv(cmd, "GOFLAGS", "-ldflags=-linkmode=internal")
+               t.addCmd(dt, "misc/cgo/test", t.goTest(), "-ldflags=-linkmode=internal", "-tags=internal", ".")
        }
 
        pair := gohostos + "-" + goarch
@@ -1190,8 +1188,7 @@ func (t *tester) cgoTest(dt *distTest) error {
                if !t.extLink() {
                        break
                }
-               cmd := t.addCmd(dt, "misc/cgo/test", t.goTest(), ".")
-               setEnv(cmd, "GOFLAGS", "-ldflags=-linkmode=external")
+               t.addCmd(dt, "misc/cgo/test", t.goTest(), "-ldflags=-linkmode=external", ".")
 
                t.addCmd(dt, "misc/cgo/test", t.goTest(), "-ldflags", "-linkmode=external -s", ".")
 
@@ -1211,8 +1208,7 @@ func (t *tester) cgoTest(dt *distTest) error {
                "netbsd-386", "netbsd-amd64",
                "openbsd-386", "openbsd-amd64", "openbsd-arm", "openbsd-arm64", "openbsd-mips64":
 
-               cmd := t.addCmd(dt, "misc/cgo/test", t.goTest(), ".")
-               setEnv(cmd, "GOFLAGS", "-ldflags=-linkmode=external")
+               cmd := t.addCmd(dt, "misc/cgo/test", t.goTest(), "-ldflags=-linkmode=external", ".")
                // cgo should be able to cope with both -g arguments and colored
                // diagnostics.
                setEnv(cmd, "CGO_CFLAGS", "-g0 -fdiagnostics-color")