diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go index 318f4393e3..6ac625cfce 100644 --- a/src/cmd/go/go_test.go +++ b/src/cmd/go/go_test.go @@ -224,13 +224,11 @@ func TestMain(m *testing.M) { os.Unsetenv("GOBIN") os.Unsetenv("GOPATH") os.Unsetenv("GIT_ALLOW_PROTOCOL") - if home, ccacheDir := os.Getenv("HOME"), os.Getenv("CCACHE_DIR"); home != "" && ccacheDir == "" { - // On some systems the default C compiler is ccache. - // Setting HOME to a non-existent directory will break - // those systems. Set CCACHE_DIR to cope. Issue 17668. - os.Setenv("CCACHE_DIR", filepath.Join(home, ".ccache")) - } os.Setenv("HOME", "/test-go-home-does-not-exist") + // On some systems the default C compiler is ccache. + // Setting HOME to a non-existent directory will break + // those systems. Disable ccache and use real compiler. Issue 17668. + os.Setenv("CCACHE_DISABLE", "1") if os.Getenv("GOCACHE") == "" { os.Setenv("GOCACHE", testGOCACHE) // because $HOME is gone } diff --git a/src/cmd/go/script_test.go b/src/cmd/go/script_test.go index 90cf3a5679..389485bc65 100644 --- a/src/cmd/go/script_test.go +++ b/src/cmd/go/script_test.go @@ -87,6 +87,7 @@ func (ts *testScript) setup() { "WORK=" + ts.workdir, // must be first for ts.abbrev "PATH=" + testBin + string(filepath.ListSeparator) + os.Getenv("PATH"), homeEnvName() + "=/no-home", + "CCACHE_DISABLE=1", // ccache breaks with non-existent HOME "GOARCH=" + runtime.GOARCH, "GOCACHE=" + testGOCACHE, "GOOS=" + runtime.GOOS,