aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/dist/test.go
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2022-11-21 21:30:02 -0500
committerGopher Robot <gobot@golang.org>2023-01-26 23:32:05 +0000
commitc611ef28606ddd7450cf03e070e51ac6082fdad7 (patch)
tree937569fed66dfd6d39054b248ef9823054662453 /src/cmd/dist/test.go
parent8e0781e5ff0320d8a0cb04dded9aa0ff8f3849cd (diff)
downloadgo-c611ef28606ddd7450cf03e070e51ac6082fdad7.tar.gz
go-c611ef28606ddd7450cf03e070e51ac6082fdad7.zip
cmd/dist: restore the original GOCACHE before building std and cmd
The user is likely to run other commands that need these libraries immediately after they are built. For #57734. Updates #56889. Change-Id: I2a1a234e6031d85f017ee692ea1ace8c6e0e7355 Reviewed-on: https://go-review.googlesource.com/c/go/+/452679 Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/cmd/dist/test.go')
-rw-r--r--src/cmd/dist/test.go11
1 files changed, 0 insertions, 11 deletions
diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go
index 3182fd4e45..0cd5113a60 100644
--- a/src/cmd/dist/test.go
+++ b/src/cmd/dist/test.go
@@ -773,7 +773,6 @@ func (t *tester) registerTests() {
pkg: "fmt",
}).command(t)
unsetEnv(cmd, "GOROOT")
- unsetEnv(cmd, "GOCACHE") // TODO(bcmills): ...why‽
err := cmd.Run()
if rerr := os.Rename(moved, goroot); rerr != nil {
@@ -1699,18 +1698,8 @@ func (t *tester) makeGOROOTUnwritable() (undo func()) {
}
}
- gocache := os.Getenv("GOCACHE")
- if gocache == "" {
- panic("GOCACHE not set")
- }
- gocacheSubdir, _ := filepath.Rel(dir, gocache)
-
filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error {
if suffix := strings.TrimPrefix(path, dir+string(filepath.Separator)); suffix != "" {
- if suffix == gocacheSubdir {
- // Leave GOCACHE writable: we may need to write test binaries into it.
- return filepath.SkipDir
- }
if suffix == ".git" {
// Leave Git metadata in whatever state it was in. It may contain a lot
// of files, and it is highly unlikely that a test will try to modify