]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: use testGOROOT in TestListTemplateContextFunction
authorBryan C. Mills <bcmills@google.com>
Thu, 10 Mar 2022 20:09:17 +0000 (15:09 -0500)
committerBryan Mills <bcmills@google.com>
Mon, 14 Mar 2022 17:51:51 +0000 (17:51 +0000)
This test uses testgo to run 'go list', so it should use the correct
GOROOT for testgo. (This may be particularly relevant when the test
binary itself is build with -trimpath, in which case runtime.GOROOT()
is not valid.)

Updates #51483

Change-Id: I79b310f88e3a200122d6289073df1385e3e97cca
Reviewed-on: https://go-review.googlesource.com/c/go/+/391801
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>

src/cmd/go/go_test.go

index 01356f9dd00a53d03df6eab6a34b92d2fdb20b82..fa0d44dae60ddc6dcaf81889f25f82b90354b8ea 100644 (file)
@@ -1631,7 +1631,7 @@ func TestListTemplateContextFunction(t *testing.T) {
        }{
                {"GOARCH", runtime.GOARCH},
                {"GOOS", runtime.GOOS},
-               {"GOROOT", filepath.Clean(runtime.GOROOT())},
+               {"GOROOT", testGOROOT},
                {"GOPATH", os.Getenv("GOPATH")},
                {"CgoEnabled", ""},
                {"UseAllFiles", ""},