-
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: provide an easy way to fetch the "latest" commit version from the default branch #29761
Comments
This will be harder or require extra care for repositories that use different branches for different versions. The module version may not exist in the source control system's default branch. |
Since it's hasn't been mentioned yet in this issue yet, I want to make the following observation. For repositories that are known to be git, For example, consider the https://github.com/rsc/go-get-default-branch repository, which has
I don't know whether this is intended and supported, or just incidental, but it works in Of course, /cc @heschik FYI. |
@dmitshur Correct, the go command works as you described and picks up the latest commit from the default branch when there are no tags in the repository. That's the behavior inherited from GOPATH mode. Once the repo starts getting tags that can be interpreted as semver or module mode tags, the default is one of the tagged version. This feature request is about exposing the functionality to pick up the latest pseudo-version easily. |
@dmitshur corrected me offline - |
I don't believe we should make any changes here. x/text is not being managed properly but that's x/text's problem not cmd/go's. The model here is that if a publisher is tagging versioned commits, then those are the "exported" ones and everything else is "unexported". Now, they're still visible, but they're not what you are supposed to get. There is intentionally no word that means "no matter what just grab the very latest activity in the repo" across all version control systems - we don't want to encourage that behavior. There are lots of options that are specific to the version control used in the repo: |
Thanks @rsc. I interpret that once a repository graduates from the pseudo-version period, and starts to use tagged release/pre-release semvers, the 'latest' version should be always one of the tagged versions. Users who want to pick up the latest "commit" should get the version by explicitly specifying |
As described in
go help module-get
,go get
with the version suffix@latest
chooses the latest tagged release version instead of the latestcommit if there are tagged versions in the vcs.
For example,
go get -m golang.org/x/text
currently fetches the v0.3.0which is more than one year-old, pre-module tagged version.
Sometimes it's useful to check the availability of the latest untagged version
(pseudo-version). Users can figure it out using the default branch name
as the suffix (e.g. go get -m golang.org/x/text@master) but the default
branch name varies depending on repos so it requires a bit of digging and
knowledge about the vcs.
The text was updated successfully, but these errors were encountered: