mirror of https://github.com/golang/go.git
cmd/vet: do not write test vet binary to GOROOT
Updates #28387 Change-Id: Ie5a5f1f798eb5900f9c7bdef165abcca02dd0dde Reviewed-on: https://go-review.googlesource.com/c/163037 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
8827147932
commit
165a8d93cd
|
|
@ -21,15 +21,21 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const dataDir = "testdata"
|
||||||
dataDir = "testdata"
|
|
||||||
binary = "./testvet.exe"
|
var binary string
|
||||||
)
|
|
||||||
|
|
||||||
// We implement TestMain so remove the test binary when all is done.
|
// We implement TestMain so remove the test binary when all is done.
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
|
dir, err := ioutil.TempDir("", "vet_test")
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintln(os.Stderr, err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
defer os.RemoveAll(dir)
|
||||||
|
binary = filepath.Join(dir, "testvet.exe")
|
||||||
|
|
||||||
result := m.Run()
|
result := m.Run()
|
||||||
os.Remove(binary)
|
|
||||||
os.Exit(result)
|
os.Exit(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue