From 4d5dafd360a5c53bc883e8e70d917b67b79f95fb Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Tue, 14 Jan 2020 16:22:20 +0100 Subject: [PATCH] main: fix race condition in tests This caused most tests to run the zeroalloc.go test instead of what they should have been tested, and in turn explains most of the performance gains of parallel testing. This commit fixes it by avoiding race conditions. Luckily, no tests started failing since then due to this. --- main_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main_test.go b/main_test.go index 2a9c78280..188f318e8 100644 --- a/main_test.go +++ b/main_test.go @@ -72,6 +72,8 @@ func runPlatTests(target string, matches []string, t *testing.T) { t.Parallel() for _, path := range matches { + path := path // redefine to avoid race condition + switch { case target == "wasm": // testdata/gc.go is known not to work on WebAssembly