-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: 'go get repo@<commit>' succeeds when <commit> is the full hash of an unpublished commit #30434
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
@gopherbot please add label modules |
Is the commit in question reachable from any published branch or tag? If not, then that would explain this behavior, and it's arguably a bug that we allow the version to be resolved at all. |
Yes, this makes sense, it became unreachable at some moment. The interesting thing is - git can't find the commit after git clone and checkout: So I can't imagine how go was able to find the reference in the repo :) I can't name it a bug for sure, but I believe everyone will win if the behaviour becomes more stable. If go resolves the full commit and you think it's OK, then it must be able to resolve the partial ones. But I believe it's much better to forbid resolving such commits. The best option is to return some descriptive error like |
|
CC @jayconrod |
Closing this in favor of #31191. I am also confused by something: once That would conflict with my understanding that git does not allow unreachable refs to be fetched remotely. (If it were already in the modcache it's reasonable that the go tool would find it there.) |
I believe so, yes. The stock Git server does not serve unreachable refs, but the underlying protocol does not preclude it, and some alternate implementations (such as GitHub) are more lax. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, I also tried go1.12
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
go get
fails to resolve just a single revision from our repository, unless full commit string is passedI get
Then I clean my mod cache
go clean -modcache
, try to get the required revision and receive an error:go get <repo>@51190595363f
also fails.Though it works on some other commit
go get <repo>@413960593a24cfdc
I really don't know how to reproduce it in public to debug this and have no ideas where it comes from.
Would be glad to provide any info if you give me some hint.
What did you expect to see?
go get
must succeed.What did you see instead?
The text was updated successfully, but these errors were encountered: