From 2e792a8295d7c7f082cf2e3b163a3d4d30b6df7e Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Wed, 18 Jan 2023 10:08:34 -0500 Subject: [PATCH] cmd/go: do not attempt to install cmd/addr2line in TestScript/mod_outside Tests must not write to GOROOT: it might not writable (for example, if it is owned by root and the user is non-root), and in general we can't assume that the configuration in which the test is run matches the configuration with which the installed tools were built. In this specific case, CL 454836 (for #57007) installs 'cmd' with CGO_ENABLED=0, but most builders still run the tests with CGO_ENABLED unset. Updates #57007. Change-Id: I2795fcd3ff61c164dc730b62f697f307ab3a167b Reviewed-on: https://go-review.googlesource.com/c/go/+/461689 Reviewed-by: Cherry Mui Run-TryBot: Bryan Mills Auto-Submit: Bryan Mills TryBot-Result: Gopher Robot --- src/cmd/go/testdata/script/mod_outside.txt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/cmd/go/testdata/script/mod_outside.txt b/src/cmd/go/testdata/script/mod_outside.txt index ed13e59f36..7a0dc9f22f 100644 --- a/src/cmd/go/testdata/script/mod_outside.txt +++ b/src/cmd/go/testdata/script/mod_outside.txt @@ -203,13 +203,6 @@ stderr '^go: ''go install'' requires a version when current directory is not in ! go install ./needmod/needmod.go stderr 'needmod[/\\]needmod.go:10:2: no required module provides package example.com/version: go.mod file not found in current directory or any parent directory; see ''go help modules''$' -# 'go install' for a package in GOROOT should succeed. -# (It must be non-stale here so that the test does not write to GOROOT). -go build -o $devnull cmd/addr2line # make sure any necessary dependencies are present in GOCACHE -! stale cmd/addr2line -go install cmd/addr2line -! stderr . - # 'go run' should fail if a package argument must be resolved to a module. ! go run example.com/printversion stderr '^no required module provides package example.com/printversion: go.mod file not found in current directory or any parent directory; see ''go help modules''$' -- 2.48.1