Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: go test and go generate add the wrong go to $PATH when the go command is run from the cross-compiled bin subdirectory #64963

Open
bcmills opened this issue Jan 4, 2024 · 1 comment
Assignees
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@bcmills
Copy link
Member

bcmills commented Jan 4, 2024

Go version

dfb2e42

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

@bcmills bcmills added NeedsFix The path to resolution is known, but the work has not been done. GoCommand cmd/go labels Jan 4, 2024
@bcmills bcmills added this to the Backlog milestone Jan 4, 2024
@bcmills bcmills self-assigned this Jan 4, 2024
@gopherbot
Copy link

Change https://go.dev/cl/560782 mentions this issue: cmd/go: fix tests that fail when running a cross-compiled GOARCH

gopherbot pushed a commit that referenced this issue Feb 5, 2024
In CL 356611 I changed cmd/go to run most of its tests (instead of
skipping them all) when cross-compiled, such as with GOARCH=386 on an
amd64 host. Unfortunately, since we don't have a CI builder that runs
long tests in a cross-compiled configuration, some of the tests have
rotted since then.

This fixes 'GOARCH=386 go test cmd/go' on my workstation.

For #64963.
Updates #53936.

Change-Id: If7f4bc8e8d1ace7d36010d7a1b652fc7b2ceb276
Cq-Include-Trybots: luci.golang.try:gotip-linux-386-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/560782
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
ezz-no pushed a commit to ezz-no/go-ezzno that referenced this issue Feb 18, 2024
In CL 356611 I changed cmd/go to run most of its tests (instead of
skipping them all) when cross-compiled, such as with GOARCH=386 on an
amd64 host. Unfortunately, since we don't have a CI builder that runs
long tests in a cross-compiled configuration, some of the tests have
rotted since then.

This fixes 'GOARCH=386 go test cmd/go' on my workstation.

For golang#64963.
Updates golang#53936.

Change-Id: If7f4bc8e8d1ace7d36010d7a1b652fc7b2ceb276
Cq-Include-Trybots: luci.golang.try:gotip-linux-386-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/560782
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants