Skip to content

cmd/go: mod edit: missing -droptoolchain flag #73744

@maxb

Description

@maxb

Go version

go version go1.24.3 linux/amd64

Output of go env in your module/workspace:

n/a

What did you do?

'go get -u ' resulted in automatically adding a toolchain line to go.mod

I wanted to remove it again, using 'go mod edit' so the update and follow-up were reproducible as a CLI command for later re-use.

What did you see happen?

'go mod edit' has flags to do almost any other transformation of a go.mod you might want, including '-toolchain' for adding a toolchain. Pretty much every other flag has a '-dropXXX' equivalent.

What did you expect to see?

But '-droptoolchain' is missing.

Activity

added
ToolProposalIssues describing a requested change to a Go tool or command-line program.
on May 16, 2025
changed the title [-]go mod edit: Lacks -droptoolchain flag[/-] [+]cmd/go: mod edit: missing -droptoolchain flag[/+] on May 16, 2025
added
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
on May 16, 2025
mknyszek

mknyszek commented on May 16, 2025

@mknyszek
Contributor

CC @golang/command-line

added this to the Backlog milestone on May 16, 2025
added
FeatureRequestIssues asking for a new feature that does not need a proposal.
on May 16, 2025
gopherbot

gopherbot commented on May 19, 2025

@gopherbot
Contributor

Change https://go.dev/cl/674075 mentions this issue: cmd/go: mod edit: add -droptoolchain flag

added
FixPendingIssues that have a fix which has not yet been reviewed or submitted.
and removed
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
on May 24, 2025
matloob

matloob commented on May 27, 2025

@matloob
Contributor

go mod edit is mainly intended to be used by tools. For users, the way to remove the toolchain directive is go get toolchain@none. Maybe we should improve the documentation about this?

matloob

matloob commented on May 27, 2025

@matloob
Contributor

I should also add that in Go 1.25, the go command will add the toolchain line in fewer instances. Running go get -u won't add a toolchain directive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestIssues asking for a new feature that does not need a proposal.FixPendingIssues that have a fix which has not yet been reviewed or submitted.GoCommandcmd/goToolProposalIssues describing a requested change to a Go tool or command-line program.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      Participants

      @maxb@mknyszek@gopherbot@seankhliao@matloob

      Issue actions

        cmd/go: mod edit: missing -droptoolchain flag · Issue #73744 · golang/go