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: crash in bad usage #61258

Closed
rsc opened this issue Jul 10, 2023 · 2 comments
Closed

cmd/go: crash in bad usage #61258

rsc opened this issue Jul 10, 2023 · 2 comments
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Jul 10, 2023

% go get go@go1.21
panic: bad requirement: rootModules[4] = go

goroutine 1 [running]:
cmd/go/internal/modload.newRequirements(0x1, {0xc0003d4600?, 0xb, 0x10}, 0xc00030c0c0)
	/Users/rsc/go/src/cmd/go/internal/modload/buildlist.go:135 +0x53c
cmd/go/internal/modload.editRequirements({0x178b418, 0x1b33b40}, 0xc00008e140, {0x0, 0x0, 0x15deb80?}, {0xc0002028e0, 0x1, 0xc000248160?})
	/Users/rsc/go/src/cmd/go/internal/modload/edit.go:564 +0x1609
cmd/go/internal/modload.EditBuildList({0x178b418, 0x1b33b40}, {0x0, 0x0, 0x0}, {0xc0002028e0, 0x1, 0x1})
	/Users/rsc/go/src/cmd/go/internal/modload/buildlist.go:640 +0x85
cmd/go/internal/modget.(*resolver).updateBuildList(0xc000376000, {0x178b418, 0x1b33b40}, {0x0, 0x0, 0x0})
	/Users/rsc/go/src/cmd/go/internal/modget/get.go:1857 +0x293
cmd/go/internal/modget.(*resolver).resolveQueries(0xc000376000, {0x178b418, 0x1b33b40}, {0xc00006c0b0, 0x1, 0x15b8520?})
	/Users/rsc/go/src/cmd/go/internal/modget/get.go:1300 +0x228
cmd/go/internal/modget.runGet({0x178b418, 0x1b33b40}, 0xc0000286d8?, {0xc000022200, 0x1, 0x1})
	/Users/rsc/go/src/cmd/go/internal/modget/get.go:335 +0x454
main.invoke(0x1af8460, {0xc0000221f0, 0x2, 0x2})
	/Users/rsc/go/src/cmd/go/main.go:264 +0x5f1
main.main()
	/Users/rsc/go/src/cmd/go/main.go:182 +0x778
@rsc rsc added NeedsFix The path to resolution is known, but the work has not been done. release-blocker labels Jul 10, 2023
@rsc rsc added this to the Go1.21 milestone Jul 10, 2023
@bcmills bcmills added the GoCommand cmd/go label Jul 10, 2023
@bcmills
Copy link
Member

bcmills commented Jul 11, 2023

I suspect this line is the cause:
https://cs.opensource.google/go/go/+/refs/heads/master:src/cmd/go/internal/modload/query.go;l=716-718;drc=6a063b01b0b0effa787c5aed90b585b409fe4688

It is probably causing modload.QueryPattern to return a spurious nil error.

@gopherbot
Copy link

Change https://go.dev/cl/509097 mentions this issue: cmd/go: fix go get go@badversion

bradfitz pushed a commit to tailscale/go that referenced this issue Jul 15, 2023
It was panicking instead of printing a nice error.

Fixes golang#61258.
Fixes golang#61259.

Change-Id: Ia30853db5bc7f1f2a4c7e91169c659ae2b79adcb
Reviewed-on: https://go-review.googlesource.com/c/go/+/509097
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
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. release-blocker
Projects
None yet
Development

No branches or pull requests

3 participants