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 get module_path/v2
does not get v2 branch
#33010
Comments
https://github.com/golang/go/wiki/Modules
etc The v2 in a module definition is looking for a git tag, not a branch. The tag can live on any branch you'd like AFAIK. (it doesn't have to be called v2) |
@jadekler The problem is that v2 development is not stable yet (thus untaggable), but modules being developed which require the v2 API have no way of using it. |
Tag edit: MVS doesn't use these unless they're directly depended upon, btw. That is, if versions |
But it's not a candidate for release... tagging such would basically be dishonest. 😕 So there's no way to specify a particular branch? Why then does |
There are a couple options here. As @jadekler suggested, you can tag prerelease versions like In terms of
|
go get module_path/v2
does not get v2 branchgo get module_path/v2
does not get v2 branch
Wouldn't this require tagging every commit? The goal is to always get the latest commit on a branch, just like
If this is true, could the documentation be changed to make this very clear? This is unfortunate, since I suppose we'd need a different branch like you suggest, Would simply using a branch named |
Yes: specifically, any name for which |
That depends on your use case. Downstream users will only pick up version tags automatically. If you need users to be able to pick up every commit, then every commit should be tagged. But this is usually not the case. Developers preparing a change that requires something that hasn't been released yet can
Yes, we should improve that. This should be called out in |
Thanks for the clarifications! |
Change https://golang.org/cl/185979 mentions this issue: |
Hi, it doesn't seems to work for me... did it work for you? If I useeither "v2-dev" or "dev-v2" I get In the go.mod file I updated the module name to v2. |
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?
Ran
go get github.com/caddyserver/caddy/v2
to make the v2 branch of the caddy module a dependency in go.mod.What did you expect to see?
A successful
go get
and adding the module to go.mod.Since v2 is a WIP, there is no v2.0.0 tag, but there is a v2 branch, which the documentation mentions is required for new major versions (either that or a v2 subfolder).
What did you see instead?
There is a workaround: Specifying a specific commit by appending
@<sha>
with a commit in the v2 branch works, e.g.:go get github.com/caddyserver/caddy/v2@902ec37
However this is not an obvious solution IMO, or at least I didn't see it documented (or documented clearly).
The text was updated successfully, but these errors were encountered: