-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: print import stack when reporting error constructing build list #30661
Comments
Change https://golang.org/cl/166984 mentions this issue: |
@jayconrod I had this question when ran this for the first time. If you see an error like this:
First, does the first transition there represent an upgrade? If so, I didn't understand that at first, and at first I thought that Second, I think the main module is implied? If so, maybe the "get" could be eliminated and add in the main module as the first line? I don't think this is quite perfect, but maybe something like:
CC @mfridman |
@thepudds "upgraded to" is probably the right phrasing. @heschik also asked me about this today, too. I'll change it.
About the main module, unfortunately, that's a difficult change to make because we don't know whether requirements are direct or transitive when that error comes up. We should refactor this. It will be a complicated change though. |
Change https://golang.org/cl/171150 mentions this issue: |
mvs.BuildList reports errors with a chain of modules to make it clear why the module where the error occurred was part of the build. This is a little confusing with "go get -u" since there are edges in the module graph for requirements and for updates. With this change, we now print "requires" or "updates to" between each module version in the chain. Updates #30661 Change-Id: Ie689500ea86857e715b250b9e0cae0bc6686dc32 Reviewed-on: https://go-review.googlesource.com/c/go/+/171150 Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
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 thego.mod
in that repository declares the module pathgolang.org/x/lint
. The package importinggit.luolix.top/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.
The text was updated successfully, but these errors were encountered: