Skip to content

Commit d465aee

Browse files
committed
cmd/internal/testdir: fix failure when GOAMD64=v3 is specified in goenv file
Fixes #68548 Add GOENV=off, GOFLAGS= to the build of the stdlib, so that it matches what runcmd does. This ensures that the runtime and the test are built with the same flags. As opposed to before this CL, where flags were used in the stdlib build but not the runcmd build. (Part of the problem here is that cmd/internal/testdir/testdir_test.go plays fast and loose with the build cache to make the tests run faster. Maybe some of that fast-and-loose mechanism can be removed now that we have a better build cache? I'm not sure.) Change-Id: I449d4ff517c69311d0aa4411e7fb96c0cca49269 Reviewed-on: https://go-review.googlesource.com/c/go/+/600276 Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Michael Matloob <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent f428c7b commit d465aee

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/cmd/internal/testdir/testdir_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@ var stdlibImportcfgString string
219219

220220
func stdlibImportcfg() string {
221221
stdlibImportcfgStringOnce.Do(func() {
222-
output, err := exec.Command(goTool, "list", "-export", "-f", "{{if .Export}}packagefile {{.ImportPath}}={{.Export}}{{end}}", "std").Output()
222+
cmd := exec.Command(goTool, "list", "-export", "-f", "{{if .Export}}packagefile {{.ImportPath}}={{.Export}}{{end}}", "std")
223+
cmd.Env = append(os.Environ(), "GOENV=off", "GOFLAGS=")
224+
output, err := cmd.Output()
223225
if err != nil {
224226
log.Fatal(err)
225227
}

0 commit comments

Comments
 (0)