Open
Description
Go version
What operating system and processor architecture are you using (go env
)?
N/A
What did you do?
In a discussion with @matloob about #62114, I remembered the $PATH
environment logic that I added to go test
and go generate
for #51473 (comment).
What did you expect to see?
If the go
command is being run from $GOROOT/bin/$GOOS_$GOARCH
, as may be the case in multi-arch Go installations, the $PATH
setting used for go generate
and go test
should include that path.
Compare:
What did you see instead?
The $PATH
setting includes only $GOROOT/bin
:
https://cs.opensource.google/go/go/+/master:src/cmd/go/internal/base/env.go;l=41-45;drc=dfb2e4265bf7654001c77925dfbbb9c38c0d1a95
And the path used for looking up the current go
command also checks only $GOROOT/bin
:
https://cs.opensource.google/go/go/+/master:src/cmd/go/internal/generate/generate.go;l=490;drc=dfb2e4265bf7654001c77925dfbbb9c38c0d1a95
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
gopherbot commentedon Feb 2, 2024
Change https://go.dev/cl/560782 mentions this issue:
cmd/go: fix tests that fail when running a cross-compiled GOARCH
cmd/go: fix tests that fail when running a cross-compiled GOARCH
cmd/go: fix tests that fail when running a cross-compiled GOARCH
PATH
whengo run
/go generate
runs the built binary #68005