Skip to content

cmd/go: confusing docs for -dropreplace #34930

@josharian

Description

@josharian

I wanted to programmatically drop all replace directives for a particular module.

Based on the docs, I initially thought just using -dropreplace=old, with no @v, would drop all replace directives for that module path:

The -replace=old[@v]=new[@v] and -dropreplace=old[@v] flags
add and drop a replacement of the given module path and version pair.
If the @v in old@v is omitted, the replacement applies to all versions
with the old module path.

It sounds from this like omitting the @v from a -dropreplace flag will make it apply to (drop) all versions with the old module path. What it actually does is drop any replace directives for that module path that do not specify a version.

It might be worth clarifying the docs a little.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.modules

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions