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: for package loading errors, decide when to show source position or import stack #43696

Open
jayconrod opened this issue Jan 14, 2021 · 0 comments
Labels
NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@jayconrod
Copy link
Contributor

In cmd/go/internal/load.PackageError.Error, we have some complicated logic that decides whether we print a source position or an import stack with an error. Currently, we print the source position if it's available (with one exception for importing an internal package from a place that's not allowed). If the source position isn't available, we print the import stack.

For deeply imported packages, especially those in other modules, the source position isn't necessarily more useful than the import stack. The user may have no knowledge of an indirect dependency that can't be loaded in their specific configuration. We may also want to print the source position together with the import stack.

We should document whatever we decide, even if we don't change anything to avoid confusion in the future.

This shouldn't affect the output of go list -json or go list -f.

cc @bcmills @matloob

@jayconrod jayconrod added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Jan 14, 2021
@jayconrod jayconrod added this to the Go1.17 milestone Jan 14, 2021
@jayconrod jayconrod modified the milestones: Go1.17, Backlog May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

1 participant