Skip to content

Commit

Permalink
cmd/vet: do not write test vet binary to GOROOT
Browse files Browse the repository at this point in the history
Updates #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]>
  • Loading branch information
Bryan C. Mills committed Feb 19, 2019
1 parent 8827147 commit 165a8d9
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/cmd/vet/vet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,21 @@ import (
"testing"
)

const (
dataDir = "testdata"
binary = "./testvet.exe"
)
const dataDir = "testdata"

var binary string

// We implement TestMain so remove the test binary when all is done.
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()
os.Remove(binary)
os.Exit(result)
}

Expand Down

0 comments on commit 165a8d9

Please sign in to comment.