From 58631ba54f45506f2f178bb01d22273e7dfba674 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Wed, 9 Mar 2022 17:19:23 -0500 Subject: internal/testenv: add GOROOT and use it to fix tests broken with -trimpath This fixes many (but not all) of the tests that currently fail (due to a bogus path reported by runtime.GOROOT) when run with 'go test -trimpath std cmd'. Updates #51461 Change-Id: Ia2cc05705529c4859e7928f32eeceed647f2e986 Reviewed-on: https://go-review.googlesource.com/c/go/+/391806 Trust: Bryan Mills Run-TryBot: Bryan Mills Reviewed-by: Russ Cox TryBot-Result: Gopher Robot --- src/cmd/nm/nm_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cmd/nm/nm_test.go') diff --git a/src/cmd/nm/nm_test.go b/src/cmd/nm/nm_test.go index 0d51b07a44..226c2c3bcd 100644 --- a/src/cmd/nm/nm_test.go +++ b/src/cmd/nm/nm_test.go @@ -66,7 +66,7 @@ func TestNonGoExecs(t *testing.T) { "internal/xcoff/testdata/gcc-ppc64-aix-dwarf2-exec", } for _, f := range testfiles { - exepath := filepath.Join(runtime.GOROOT(), "src", f) + exepath := filepath.Join(testenv.GOROOT(t), "src", f) if strings.HasSuffix(f, ".base64") { tf, err := obscuretestdata.DecodeToTempFile(exepath) if err != nil { -- cgit v1.3