Skip to content

Commit

Permalink
debug/buildinfo: use testenv.GoToolPath in tests instead of resolving…
Browse files Browse the repository at this point in the history
… "go" from $PATH

Updates #37475.

Change-Id: I8c3237438da3e9521ce3be26a0b5d5ca36944b17
Reviewed-on: https://go-review.googlesource.com/c/go/+/391803
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Trust: Daniel Martí <mvdan@mvdan.cc>
  • Loading branch information
Bryan C. Mills committed Mar 14, 2022
1 parent 7900576 commit 471d319
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/debug/buildinfo/buildinfo_test.go
Expand Up @@ -66,7 +66,7 @@ func TestReadFile(t *testing.T) {
t.Fatal(err)
}
outPath := filepath.Join(dir, path.Base(t.Name()))
cmd := exec.Command("go", "build", "-o="+outPath)
cmd := exec.Command(testenv.GoToolPath(t), "build", "-o="+outPath)
cmd.Dir = dir
cmd.Env = append(os.Environ(), "GO111MODULE=on", "GOOS="+goos, "GOARCH="+goarch)
stderr := &bytes.Buffer{}
Expand All @@ -89,7 +89,7 @@ func TestReadFile(t *testing.T) {
t.Fatal(err)
}
outPath := filepath.Join(gopathDir, path.Base(t.Name()))
cmd := exec.Command("go", "build", "-o="+outPath)
cmd := exec.Command(testenv.GoToolPath(t), "build", "-o="+outPath)
cmd.Dir = pkgDir
cmd.Env = append(os.Environ(), "GO111MODULE=off", "GOPATH="+gopathDir, "GOOS="+goos, "GOARCH="+goarch)
stderr := &bytes.Buffer{}
Expand Down

0 comments on commit 471d319

Please sign in to comment.