]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: test: clean up all temporary directories
authorMichael Fraenkel <michael.fraenkel@gmail.com>
Wed, 30 Apr 2014 17:03:38 +0000 (13:03 -0400)
committerIan Lance Taylor <iant@golang.org>
Wed, 30 Apr 2014 17:03:38 +0000 (13:03 -0400)
go test may call builder.init() multiple times which will create a new work directory.  The cleanup needs to hoist the current work directory.
Fixes #7904.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/95900044

src/cmd/go/build.go

index 03300555deb0da2004da84917e3be61d48f2a136..1e4571b2c71ce390d9e5b389633f0e379094b9f3 100644 (file)
@@ -447,7 +447,8 @@ func (b *builder) init() {
                        fmt.Fprintf(os.Stderr, "WORK=%s\n", b.work)
                }
                if !buildWork {
-                       atexit(func() { os.RemoveAll(b.work) })
+                       workdir := b.work
+                       atexit(func() { os.RemoveAll(workdir) })
                }
        }
 }