Skip to content

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

Closed
@bcmills

Description

@bcmills

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeGoCommandcmd/goNeedsInvestigationSomeone 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