-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
proposal: cmd/go: add signal for go get -u
to track branch
#26964
Comments
@maeglindeveloper: There might well be a better answer, but I think one approach would be to run I have not tested your specific case before, but some related snippets from the documentation:
and (with emphasis added):
and:
Those snippets are from a few different sections of the doc, but this section is perhaps most relevant: Sorry if that is off base, but what do you think about trying that? |
@maeglindeveloper and there is a little more background here: https://github.com/golang/go/wiki/Modules#how-to-upgrade-and-downgrade-dependencies I think part of the intent of modules is: In addition, my understanding is the default behavior of a Taking all of that together, maybe it is not crazy that |
(And |
go get -u
to track branch?
Note that go mod -sync does not update dependencies. We renamed it to go mod tidy, which hopefully will be less confusing in that respect. go get -u is what updates dependencies, or just 'go get dependency-name', which defaults to @latest. The command you want for an explicit update right now is just go get myrepo2@dev I've been thinking for a while about whether to have a special comment in the go.mod that means "when you update, look for this branch", in which case you could use |
The tricky part about a “use this branch” annotation is transitive dependencies. If module For So I think if we support this sort of branch redirect, it — like |
We definitely can't respect those annotations in dependencies. We might respect an annotation like that in the current go.mod. |
Linking back the other way, I think this is probably related to/dup of #26853 |
This doesn't seem to work right if there is a In our case we need to support the use of Gitlab subgroups, so we have to use a replace directive like:
Using
At least it's generating the version string so I can copy that into the right place, but usability-wise it's a bit of a nightmare. |
@Xiol, the behavior you are describing is #28176, but the particular use-case (resolving an import of |
I have a same problem. But I fixed it by making sure there are no Go files using or refer to |
I'm using OpenAPI Generator trying to merge different language SDK into same repo,that cause I need go get can track on specified branch or it will take the wrong commit or tag with other language.... |
go get -u
to track branch?go get -u
to track branch
Hi everyone,
I already posted an issue regarding go.mod files.
#26640
This one is a little bit different but little bit linked to that old one.
I'm actually developping multiple repositories using 2 branches master and dev. Those branches are defined for each repositories. Lets assume I have the following ones:
I was wondering if there is a way to specify a branch for a specific repository inside the go.mod file.
For instance:
The reason why I'm asking that is that, when I'm actually runing the
go mod -sync
cmd in my repo2, it will always check for the last commit in master (or maybe I'm wrong?). But I would like that it looks into my dev branch for the last commit.So I was thinking that maybe I can tag my dev branch and then specify the version I want to grab but it means that I will need to tag everytime I want to test my dev branch.
Does anyone have already face that pb?
Hope my explanations are clear :s
Thanks in advance ! :)
@rsc
The text was updated successfully, but these errors were encountered: