Skip to content

Commit 2a34002

Browse files
Bryan C. Millsnebulabox
Bryan C. Mills
authored andcommitted
cmd/vet: do not write test vet binary to GOROOT
Updates golang#28387 Change-Id: Ie5a5f1f798eb5900f9c7bdef165abcca02dd0dde Reviewed-on: https://go-review.googlesource.com/c/163037 Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 16c78c7 commit 2a34002

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/cmd/vet/vet_test.go

+11-5
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,21 @@ import (
2121
"testing"
2222
)
2323

24-
const (
25-
dataDir = "testdata"
26-
binary = "./testvet.exe"
27-
)
24+
const dataDir = "testdata"
25+
26+
var binary string
2827

2928
// We implement TestMain so remove the test binary when all is done.
3029
func TestMain(m *testing.M) {
30+
dir, err := ioutil.TempDir("", "vet_test")
31+
if err != nil {
32+
fmt.Fprintln(os.Stderr, err)
33+
os.Exit(1)
34+
}
35+
defer os.RemoveAll(dir)
36+
binary = filepath.Join(dir, "testvet.exe")
37+
3138
result := m.Run()
32-
os.Remove(binary)
3339
os.Exit(result)
3440
}
3541

0 commit comments

Comments
 (0)