1
0
mirror of https://github.com/golang/go synced 2024-11-18 11:04:42 -07:00

cmd/gorename: add tests that run successfully

Set the env variable to only include the correct gopath in the test.

Fixes golang/go#20805

Change-Id: I496ed5c60278e508016f915cf53a115cc3c222ae
Reviewed-on: https://go-review.googlesource.com/47410
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
suzmue 2017-07-03 22:29:01 -04:00 committed by Alan Donovan
parent 6e57528ade
commit 9dc2b714a0

View File

@ -32,7 +32,13 @@ func TestGeneratedFiles(t *testing.T) {
t.Fatal(err)
}
env := append(os.Environ(), fmt.Sprintf("GOPATH=%s", tmp))
var env = []string{fmt.Sprintf("GOPATH=%s", tmp)}
for _, envVar := range os.Environ() {
if !strings.HasPrefix(envVar, "GOPATH=") {
env = append(env, envVar)
}
}
// Testing renaming in packages that include cgo files:
for iter, renameTest := range []test{
{