Skip to content

proposal: cmd/go: allow replacing a subdirectory within a package #30886

@nhooyr

Description

@nhooyr

Right now, the replace directive only allows replacing modules with different modules.

It'd be nice if you could just replace a single sub package within a module with a different package elsewhere in a different module.

My use case is that right now goimports does not support reordering imports when there are multiple groups (#20818) and so I forked golang.org/x/tools.

Right now, I have to replace the entire module with my fork. I only modified golang.org/x/tools/imports so I only want to replace that package with the package from my fork. I don't want to maintain my fork and keep it up to date to use new additions to golang.org/x/tools. I only want to maintain the golang.org/x/tools/imports package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeProposalWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.modules

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions