cmd/go: remove work directory on usage error
authorIan Lance Taylor <ian@gcc.gnu.org>
Fri, 22 Feb 2019 00:41:25 +0000 (00:41 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Fri, 22 Feb 2019 00:41:25 +0000 (00:41 +0000)
commit8aef6e02ad1b49cd60e78caf9909e6c8aa517649
treecc75d762d2bfb435632bdb41f39e6c5f8576cd26
parent2496137abd8e367ffd5fdffde6dafbf345cd3fee
cmd/go: remove work directory on usage error

    Backport https://golang.org/cl/163237 from the master library:

        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 https://gcc.gnu.org/PR89406

    Reviewed-on: https://go-review.googlesource.com/c/163198

From-SVN: r269086
gcc/go/gofrontend/MERGE
libgo/go/cmd/go/go_test.go
libgo/go/cmd/go/internal/base/base.go
libgo/go/cmd/go/internal/cmdflag/flag.go
libgo/go/cmd/go/internal/help/help.go
libgo/go/cmd/go/internal/vet/vetflag.go
libgo/go/cmd/go/internal/work/action.go
libgo/go/cmd/go/internal/work/exec.go
libgo/go/cmd/go/internal/work/gccgo.go
libgo/go/cmd/go/internal/work/init.go
libgo/go/cmd/go/script_test.go