-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: Leave pinned version as a comment when dependency is incompatible with go modules #30993
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
Comments
Seems reasonable. Not sure if this will happen for 1.13, given how much other stuff needs to go in, but it would be nice to have. |
That said, I think this is a duplicate of #25898. Please reopen if you disagree. |
Thanks for the reply. I think that issue is different, but would accomplish the same thing. But, if you see this thread again, can you briefly explain what you mean by I see a line in |
(If your module is always the main module when you build it, then the “minimum version” is functionally equivalent to “pinning”, but we try not to make that assumption in discussions and documentation.) |
Whoa. Does this mean that an upstream dependency can release a new version that will cause my builds to fail? Does go automatically try older versions to see if one works in that case? How would one "pin" an exact upstream version if needed? Is vendoring the only option? Thanks for the reply! |
Nope: the version selected for a given (See https://research.swtch.com/vgo-mvs for details.)
The maximum of the minimum-versions explicitly listed in the module graph is always selected. The only time we try a different version is if we see an
Generally you don't need to. You set your versions, and because the |
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?
I pinned a dependency (
k8s.io/apimachinery kubernetes-1.11.7
) ingo.mod
and rango build
.What did you expect to see?
I expected my pinned version to be in the
go.mod
file.What did you see instead?
The
go.mod
file left behind a unique hash that no longer shows what I asked it to pin (k8s.io/apimachinery v0.0.0-20190118094746-1525e4dadd2d
). Go should at least leave a note indicating what human-readable version is pinned with the module hash format. This leads developers (at first use) to think that the program overrode their version pinning request.I understand this is expected behavior and that the hash indicates a static version to pull in, but I would like to see some hints left behind so people know what tag it really is. For example:
What the dev inputs:
require k8s.io/apimachinery kubernetes-1.11.7
What the dev sees after' running
go get
:What I would like to see (as a dev):
The text was updated successfully, but these errors were encountered: