-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: document how to get 'go mod tidy' to keep an unused dependency #37352
Comments
That is exactly what
Could you provide some more detail as to why you want to upgrade a module that does not provide any imported packages? |
This is not just in tip; thanks for the pointer.
|
Ah, #33008 could be related. For modules that do not contribute imported packages, the |
That's true, but we should probably provide some means to flag those regardless of how they are introduced. (That's #24031.) |
Note that if you really want to, you can introduce a dummy import of some package in order to convince |
Since we have issues filed for the other two parts, let's focus this one on the third: you have a reason to want to retain an otherwise-unused requirement, and we have a mechanism for that (a dummy import), so we should probably make the documentation for that mechanism more discoverable. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as off-topic.
This comment was marked as off-topic.
do we really need to document the self evident: add a dependency to keep a dependency? |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
In light of the recent
golang.org/x/crypto
fix, I tried to enforce that my module usev0.0.0-20200220183623-bac4c82f6975
:golang.org/x/crypto
is listed in mygo.sum
because a module I depend upon uses it:It is assumed that I am not in control of the
lib
module:However it is not needed for build, as evidenced by
go mod why
. As such, when Igo mod tidy
, it gets dropped:[user@localhost tmp]$ go mod why -m golang.org/x/crypto # golang.org/x/crypto (main module does not need module golang.org/x/crypto) [user@localhost tmp]$ go mod tidy [user@localhost tmp]$ cat go.mod
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: