-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: "go get -u" should handle missing hash #32005
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
We don't know that. go get -u might choose a "latest" that is before that pseudo-version, or maybe that module contains within it other requirements that are newer than "latest" for their own modules. In general ignoring unreachable modules is not safe. |
@rsc, since the existing entry in the That said, if we can't fetch the listed commit, then we also don't know what packages it imports or what other module versions it requires. If we don't have that information, then we could indeed end up downgrading one or more transitive dependencies. For rebases and force-pushes in particular, in many cases you will be able fetch the missing version from a proxy or mirror, and for the remainder you can always hand-edit (or |
@bcmills was this intentionally closed? Just checking. |
Yes, this was closed intentionally: if we can't load the module graph, we can't (in general) decide which modules to upgrade. |
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?
Create a module with the following
go.mod
file,The VCS hash for package xerrors is deliberately modified to point to commit hash that does not exist (
000000000001
).On the package module root directory, run
go get -u golang.org/x/xerrors
.What did you expect to see?
The "go get -u" command should update the package to latest commit on repository even if hash is not found as long as package use "latest" (incompatible?) mode.
In a perfect world, we will never seen a commit missing from master branch. However, sometimes rebase and force push happened, for any reason.
Rationale: when user use "latest" mode, we assume that they know what they are doing and the know what would happened.
What did you see instead?
The "go get -u" command return 410 Gone.
Currently, the only way to fix this is by re-initializing module back (removing "require" statements and removing go.sum file).
The text was updated successfully, but these errors were encountered: