summaryrefslogtreecommitdiff
path: root/src/cmd/go/script_test.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2019-02-20 15:15:18 -0800
committerIan Lance Taylor <iant@golang.org>2019-03-01 18:26:37 +0000
commit820ad17303e42665fbe9d38d79f07ed218e86302 (patch)
treef22e49bd089a32e5ccbea50e10bc1bf9216c7471 /src/cmd/go/script_test.go
parent7c388cc89c76bc7167287fb488afcaf5a4aa12bf (diff)
downloadgo-git-820ad17303e42665fbe9d38d79f07ed218e86302.tar.gz
cmd/go: remove work directory on usage error
Ensure that cmd/go consistently calls base.Exit rather than os.Exit, so that we don't incorrectly leave the work directory around on exit. Test this by modifying the testsuite to run all the tests with TMPDIR set to a temporary directory, and then check that no files are left behind in that temporary directory. Adjust a couple of tests to make this approach work. Updates #30500 Updates https://gcc.gnu.org/PR89406 Change-Id: Ib6a5fc8a288a6cf4713022baa2b8dfefad62ba34 Reviewed-on: https://go-review.googlesource.com/c/163237 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/script_test.go')
-rw-r--r--src/cmd/go/script_test.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/cmd/go/script_test.go b/src/cmd/go/script_test.go
index c5e0064036..e204471beb 100644
--- a/src/cmd/go/script_test.go
+++ b/src/cmd/go/script_test.go
@@ -399,6 +399,7 @@ func (ts *testScript) cmdCc(neg bool, args []string) {
var b work.Builder
b.Init()
ts.cmdExec(neg, append(b.GccCmd(".", ""), args...))
+ os.RemoveAll(b.WorkDir)
}
// cd changes to a different directory.