aboutsummaryrefslogtreecommitdiff
path: root/src/internal/testenv
diff options
context:
space:
mode:
Diffstat (limited to 'src/internal/testenv')
-rw-r--r--src/internal/testenv/testenv.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/internal/testenv/testenv.go b/src/internal/testenv/testenv.go
index c27fcfa208..f7a9730ca6 100644
--- a/src/internal/testenv/testenv.go
+++ b/src/internal/testenv/testenv.go
@@ -13,6 +13,7 @@ package testenv
import (
"errors"
"flag"
+ "internal/cfg"
"os"
"os/exec"
"path/filepath"
@@ -88,6 +89,12 @@ func GoToolPath(t testing.TB) string {
if err != nil {
t.Fatal(err)
}
+ // Add all environment variables that affect the Go command to test metadata.
+ // Cached test results will be invalidate when these variables change.
+ // See golang.org/issue/32285.
+ for _, envVar := range strings.Fields(cfg.KnownEnv) {
+ os.Getenv(envVar)
+ }
return path
}