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: improve error message for unparsable, too-new, go.mod #70979

Open
prattmic opened this issue Dec 24, 2024 · 1 comment
Open

cmd/go: improve error message for unparsable, too-new, go.mod #70979

prattmic opened this issue Dec 24, 2024 · 1 comment
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@prattmic
Copy link
Member

Split from #70949.

The tl;dr of that issue is:

  1. Set GOTOOLCHAIN=local to prevent automatic toolchain upgrade
  2. Use Go 1.23 toolchain
  3. go.mod says 1.24rc1 and contains a tool block

The 1.23 toolchain does not upgrade because of GOTOOLCHAIN=local, so it attempts to parse the go.mod itself. It does not understand tool blocks, so it reports a parse error:

go: errors parsing go.mod:
go.mod:206: unknown block type: tool

We could have a better error message in this case. Perhaps one of:

  1. Add a hint to the above error that GOTOOLCHAIN=local prevented and upgrade
  2. Or (my preference), stop immediately after determining the module Go version without fully parsing the go.mod, since we won't build such a module anyway.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants