Skip to content

Commit

Permalink
cmd/link: fix data race in testDWARF
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Reviewed-by: Josh Bleecher Snyder <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
  • Loading branch information
cherrymui committed Apr 6, 2020
1 parent 44ae947 commit 23866ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cmd/link/dwarf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 23866ae

Please sign in to comment.