Skip to content

cmd/go: print import stack when reporting error constructing build list #30661

Closed
@jayconrod

Description

@jayconrod

In module mode, every build starts by constructing the build list, the set of modules at specific versions that will be involved in the build. We construct the build list by exploring the import graph rooted at the command line arguments, adding modules to satisfy any imports that can't be resolved.

There are a number of things that can go wrong during this process, not all of which are under the user's direct control. For example, suppose a transitive dependency requires github.com/golang/lint, but the go.mod in that repository declares the module path golang.org/x/lint. The package importing github.com/golang/lint is wrong, but we don't currently report what that package is or why it's part of the build.

When an error like this occurs, we should report the chain of imports from the command line arguments to the problematic package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions