-
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: 'go mod why' should have an answer for every module in 'go list -m all' #27900
Comments
I don't think this is true, because Consider This is therefore unsurprising:
If we provide the constraints we can list the main package:
Similarly, unless we satisfy the constraints,
Again, fixed:
Hence it is not equivalent to a
Because when listing packages we need to consider build constraints:
The docs for
But that does not appear to be the case.
As you say, we need the ability to answer the question "why does I'm less clear we need something like a |
Please, keep in mind the case with |
And I think the note |
I assume this is the same issue - I was trying to update to fix a dependabot issue; but I was still left with the unpatched major version I was hoping to remove. Is there any (not intensively manual) workaround to find which main package dependency leads to it if |
@OJFord you want |
Yes, that is the case. Thanks. |
@mvdan : I think I have reached that situation, which you describe as a bug : I was looking into a way to cut the dependency on My current attempt is here : https://github.com/LeGEC/google-api-go-client/ (at commit 3005284e02) On my laptop, I am currently in the following state :
I'm trying to clear the various caches I am aware of ( |
@LeGEC, I'm happy to help with that problem but it's a bit off-topic for this issue. Consider starting a thread on |
@bcmills any chance you can link a follow-up here is there was one? I'm in a similar situation as described in #27900 (comment) where a CVE is involved and its unclear if our package is impacted. The vulnerable module is mentioned in go.sum and |
@jan--f, if the CVE in question is included in https://pkg.go.dev/vuln/, I would suggest using |
It's not yet merged unfortunately, though proposed. In any case I experience the same situation @LeGEC describes, so I'd be thankful for pointer to follow up on any threads of slack conversations. |
This is the case. |
Same here, can give a reproducible env for it if needed |
Can we quote the rest of that paragraph without pinging me going forwards please 😅 |
Hello, I've bumped into this here and there and think I've reproduced what is causing some confusion for me: There is a module dependency on goldmark, but since the package which needs it isn't used, it will be pruned from the package tree, but not the module tree, if that makes sense. But then @mvdan Would this example line up with what you meant here?
I think it would be very useful to get an |
I ended up here because I was trying to find a way to identify why dependency is listed in my |
@tonecool try running |
Thanks @dmitris, adding |
Currently, if you run
go mod why -m
on the output of every module ingo list -m all
, some modules may come back with the answer(main module does not need module […])
, even after ago mod tidy
.The reason is that the module graph is conservative:
go list -m all
answers the question “which module versions are implied by the requirements of the main module?”, not “which modules does the main module need to download to completego list all
?”.¹In contrast,
go mod why
explicitly ties its answer togo list all
.We should have some flag to
go mod why
to answer the relatedgo list -m all
question, “what path of requirements imposes the version requirement on modulex
?”¹The command to answer the latter question, as it turns out, is:
The text was updated successfully, but these errors were encountered: