Skip to content

cmd/go: TestScript/gotoolchain_path fails if golang.org/dl/go1.21.1 is installed in the user's $PATH #62709

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

Closed
bcmills opened this issue Sep 18, 2023 · 4 comments
Assignees
Labels
FrozenDueToAge GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done. release-blocker Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Sep 18, 2023

~$ gotip version
go version devel go1.22-ee788dba Sat Sep 9 01:48:44 2023 +0000 linux/amd64

~$ gotip test cmd/go -run=TestScript/gotoolchain_path
vcs-test.golang.org rerouted to http://127.0.0.1:44505
https://vcs-test.golang.org rerouted to https://127.0.0.1:45531
go test proxy running at GOPROXY=http://127.0.0.1:44641/mod
--- FAIL: TestScript (0.19s)
    --- FAIL: TestScript/gotoolchain_path (0.38s)
        script_test.go:132: 2023-09-18T20:24:15Z
        script_test.go:134: $WORK=/tmp/cmd-go-test-1726110853/tmpdir535136021/gotoolchain_path2675966255
        script_test.go:156:
            # This test only checks that basic PATH lookups work.
            # The full test of toolchain version selection is in gotoolchain.txt. (0.000s)
            # Compile a fake toolchain to put in the path under various names. (0.241s)
            # GOTOOLCHAIN=go1.50.0 (0.010s)
            # GOTOOLCHAIN=path with toolchain line (0.017s)
            # GOTOOLCHAIN=path with go line (0.010s)
            # GOTOOLCHAIN=auto with toolchain line (0.013s)
            # GOTOOLCHAIN=auto with go line (0.012s)
            # NewerToolchain should find Go 1.50.0. (0.060s)
            > env GOTOOLCHAIN=local
            > go mod edit -toolchain=none -go=1.22
            > grep 'go 1.22$' go.mod
            matched: go 1.22
            > ! grep toolchain go.mod
            > env GOTOOLCHAIN=path
            > ! go run rsc.io/[email protected]
            [stderr]
            go: downloading rsc.io/fortune v0.0.1
            go: rsc.io/[email protected] requires go >= 1.21rc999; switching to go1.21.1
            go1.21.1: not downloaded. Run 'go1.21.1 download' to install to /no-home/sdk/go1.21.1
            [exit status 1]
            > stderr 'running go1.50.0 from PATH'
        script_test.go:156: FAIL: testdata/script/gotoolchain_path.txt:67: stderr 'running go1.50.0 from PATH': no match for `(?m)running go1.50.0 from PATH` in stderr
FAIL
FAIL    cmd/go  0.618s
FAIL
@bcmills bcmills added Testing An issue that has been verified to require only test changes, not just a test failure. NeedsFix The path to resolution is known, but the work has not been done. GoCommand cmd/go labels Sep 18, 2023
@bcmills bcmills self-assigned this Sep 18, 2023
@bcmills
Copy link
Contributor Author

bcmills commented Sep 18, 2023

@gopherbot, please backport to Go 1.21. This causes spurious test failures, and the fix is test-only.

@gopherbot
Copy link
Contributor

Backport issue(s) opened: #62711 (for 1.21).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/529217 mentions this issue: cmd/go: in TestScript/gotoolchain_path, remove the user's PATH

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/529435 mentions this issue: [release-branch.go1.21] cmd/go: in TestScript/gotoolchain_path, remove the user's PATH

gopherbot pushed a commit that referenced this issue Sep 19, 2023
…e the user's PATH

This test checks a behavior of GOTOOLCHAIN when an appropriate
toolchain is found in PATH. That requires it to exclude any suitable
toolchain binaries from the user's $PATH, which may otherwise
interfere.

Fixes #62711.
Updates #62709.

Change-Id: Ie9161e52d33a65be0b5265cb49e9f2bc8473e057
Reviewed-on: https://go-review.googlesource.com/c/go/+/529217
Auto-Submit: Bryan Mills <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
(cherry picked from commit 30886b1)
Reviewed-on: https://go-review.googlesource.com/c/go/+/529435
Run-TryBot: Bryan Mills <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Auto-Submit: Dmitri Shuralyov <[email protected]>
@golang golang locked and limited conversation to collaborators Sep 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done. release-blocker Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
Development

No branches or pull requests

2 participants