From 61fac6845a6c35253397c66bcc71a309f59d8c70 Mon Sep 17 00:00:00 2001 From: Michael Fraenkel Date: Wed, 30 Apr 2014 13:03:38 -0400 Subject: [PATCH] cmd/go: test: clean up all temporary directories 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go index 03300555de..1e4571b2c7 100644 --- a/src/cmd/go/build.go +++ b/src/cmd/go/build.go @@ -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) }) } } } -- 2.48.1