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 |
Change https://golang.org/cl/220080 mentions this issue: |
Updates golang/go#36460 Updates golang/go#27900 Updates golang/go#26955 Updates golang/go#30831 Updates golang/go#32058 Updates golang/go#32380 Updates golang/go#32419 Updates golang/go#33370 Updates golang/go#33669 Updates golang/go#36369 Change-Id: I1d4644e3e8b4e688c2fc5a569312495e5072b7d7 Reviewed-on: https://go-review.googlesource.com/c/proposal/+/220080 Reviewed-by: Russ Cox <rsc@golang.org>
I don’t think that’s correct. When I run this command in ~/distri, and ensure that the reported modules are present in the reported versions in my build environment, I’m encountering an error when running
Package |
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 |
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: