aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2020-04-06 11:41:23 -0400
committerCherry Zhang <cherryyz@google.com>2020-04-06 16:08:10 +0000
commit23866aedd960b920d8c95250818d26d2b9023c5a (patch)
tree4e5f2d2c29c6268839da45a076e5d5d1941494dc
parent44ae94751ab35232f72845c7b885c5338220bca5 (diff)
downloadgo-23866aedd960b920d8c95250818d26d2b9023c5a.tar.gz
go-23866aedd960b920d8c95250818d26d2b9023c5a.zip
cmd/link: fix data race in testDWARF
Multiple instances of testDWARF run in parallel, with a shared backing store of the env input slice. Do modification of the environment locally, instead of on the shared slice. Fixes #38265. Change-Id: I22a7194c8cd55ba22c9d6c47ac47bf7e710a7027 Reviewed-on: https://go-review.googlesource.com/c/go/+/227342 Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
-rw-r--r--src/cmd/link/dwarf_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/link/dwarf_test.go b/src/cmd/link/dwarf_test.go
index d4bb30399d..8a1b489300 100644
--- a/src/cmd/link/dwarf_test.go
+++ b/src/cmd/link/dwarf_test.go
@@ -71,8 +71,8 @@ func testDWARF(t *testing.T, buildmode string, expectDWARF bool, env ...string)
}
cmd.Args = append(cmd.Args, dir)
if env != nil {
- env = append(env, "CGO_CFLAGS=") // ensure CGO_CFLAGS does not contain any flags. Issue #35459
cmd.Env = append(os.Environ(), env...)
+ cmd.Env = append(cmd.Env, "CGO_CFLAGS=") // ensure CGO_CFLAGS does not contain any flags. Issue #35459
}
out, err := cmd.CombinedOutput()
if err != nil {