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

cmd/go/internal/modload: spurious "package provided … at latest version but not at required version" errors #41113

Closed
bcmills opened this issue Aug 28, 2020 · 2 comments
Labels
FrozenDueToAge GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Aug 28, 2020

There appears to be a bug in our logic for determining whether a package can be resolved by adding a module.

This loop sets newMissingVersion on the returned ImportMissingError if any of the candidates returned by QueryPackage is required at a higher version in the build list.

However, if there are multiple (nested) candidate modules and only one is required at a higher version (as in the case of a module split without a requirement cycle; see also #27899), we should suggest adding one of the candidates that is viable, rather than rejecting all of them with a newMissingVersion error.

This bug was found by code inspection while working on #36460, so I still need to find a test case that reproduces it.

CC @matloob @jayconrod

@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go modules labels Aug 28, 2020
@bcmills bcmills added this to the Go1.16 milestone Aug 28, 2020
@bcmills bcmills self-assigned this Aug 28, 2020
@gopherbot
Copy link

Change https://golang.org/cl/251446 mentions this issue: cmd/go/internal/modload: fix spurious import resolution error

@bcmills
Copy link
Contributor Author

bcmills commented Aug 29, 2020

Fix pending, with a regression test that successfully reproduced the bug as expected.

@bcmills bcmills changed the title cmd/go/internal/modload: probable spurious "package provided … at latest version but not at required version" errors cmd/go/internal/modload: spurious "package provided … at latest version but not at required version" errors Aug 29, 2020
@golang golang locked and limited conversation to collaborators Sep 9, 2021
@rsc rsc unassigned bcmills Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

2 participants