From 471d319fb2497aa7239943eb1a6d5cfbad503a2a Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Thu, 10 Mar 2022 15:28:10 -0500 Subject: [PATCH] debug/buildinfo: use testenv.GoToolPath in tests instead of resolving "go" from $PATH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updates #37475. Change-Id: I8c3237438da3e9521ce3be26a0b5d5ca36944b17 Reviewed-on: https://go-review.googlesource.com/c/go/+/391803 Trust: Bryan Mills Run-TryBot: Bryan Mills TryBot-Result: Gopher Robot Reviewed-by: Daniel Martí Trust: Daniel Martí --- src/debug/buildinfo/buildinfo_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/debug/buildinfo/buildinfo_test.go b/src/debug/buildinfo/buildinfo_test.go index ac71626fda1df..0affc832e718d 100644 --- a/src/debug/buildinfo/buildinfo_test.go +++ b/src/debug/buildinfo/buildinfo_test.go @@ -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{} @@ -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{}