-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: compile error for "toolchain default" in go.mod, removed by mod tidy #73127
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
Labels
BugReport
Issues describing a possible bug in the Go implementation.
GoCommand
cmd/go
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Comments
|
toolchain default
and go mod tidy
removes toolchain default
directive
@seankhliao it's not a warning, it's an error,
|
@seankhliao Sorry, but updated title is outright wrong. It's not a warning, it's ultimately a failure to compile. Editing title. |
$ go run . go: updates to go.mod needed; to update it: go mod tidy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
BugReport
Issues describing a possible bug in the Go implementation.
GoCommand
cmd/go
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Go version
go version go1.24.1 linux/amd64
Output of
go env
in your module/workspace:What did you do?
I'm following go.mod specification which allows to disable automatic toolchain switching with
toolchain default
directive.I'm using following minimal example to reproduce the issue:
main.go
go.mod
What did you see happen?
Attempt to build or run it produces requires
go mod tidy
and ends up with following error:But running
go mod tidy
stripstoolchain
directive and leaves me with following go.modWhat did you expect to see?
I expect
go build
andgo run
to not have false positive about "dirty" go.mod and run it with original go.mod without any issue. Also I expectgo mod tidy
to respect specification and preserve directives I've set.The text was updated successfully, but these errors were encountered: