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

proposal: cmd/go: 'go mod tidy' should remove stale 'exclude' directives #29813

Open
bcmills opened this issue Jan 18, 2019 · 0 comments
Open
Labels
GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Proposal
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Jan 18, 2019

exclude directives in the go.mod file prevent commands such as go get -u from selecting particular versions of modules.

However, if the active version of a dependency is already semantically higher than the excluded version, go get -u would never select that version implicitly in the first place (depending on the resolution of #26474). The only time it could be introduced is by an explicit downgrade of some package, and explicit downgrades — though possible — are likely to be rare in practice.

That makes those exclude directives noisy and somewhat misleading: they appear to have an effect on version selection, but may actually be very stale and completely irrelevant.

I propose that go mod tidy should remove exclude directives if the selected version of the module in question is already higher than the excluded version.

(CC @rsc @jayconrod)

@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. modules labels Jan 18, 2019
@gopherbot gopherbot added this to the Proposal milestone Jan 18, 2019
@ianlancetaylor ianlancetaylor added this to Incoming in Proposals (old) Feb 24, 2021
@bcmills bcmills added the GoCommand cmd/go label Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Proposal
Projects
Status: Incoming
Development

No branches or pull requests

2 participants