Skip to content
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: accept git commit hash or tag in go get #21933

Closed
ror6ax opened this issue Sep 19, 2017 · 14 comments
Closed

cmd/go: accept git commit hash or tag in go get #21933

ror6ax opened this issue Sep 19, 2017 · 14 comments
Labels
NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. package-management
Milestone

Comments

@ror6ax
Copy link

ror6ax commented Sep 19, 2017

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

1.9

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

linux/amd64

What did you do?

go get github.com/organization/repo

What did you expect to see?

Ability to install specific version of the repo is needed.

go get in

createCmd: []string{"clone {repo} {dir}", "-go-internal-cd {dir} submodule update --init --recursive"},
uses plain git pull.

git checkout should be added afterwards to optionally checkout onto the commit provided in the following fashion:
go get github.com/organization/repo commithash123456789
go get github.com/organization/repo v1.2.1

@mvdan
Copy link
Member

mvdan commented Sep 19, 2017

How exacly would this syntax work with multiple packages, while still keeping backwards compatibility?

Also note that such a large change should come in the form of a proposal with much more detail.

@ror6ax
Copy link
Author

ror6ax commented Sep 19, 2017

Well, as in case of other languages - if you are specifying exact thing to get - it's your problem that it does not work. I personally know many people who are using additional tools/dirty hacks to get this functionality.

Adding the naive matching is better that nothing in such scenario.

Sorry, this is my first work with golang codebase, I'll look up how to create proposals in more formal way.

@243083df
Copy link

243083df commented Sep 19, 2017

If you want to specific version, you should use https://github.com/golang/dep instead

@mvdan
Copy link
Member

mvdan commented Sep 19, 2017

Adding the naive matching is better that nothing in such scenario.

I don't see how. Doing go get foo.com/foo bar.com/bar means one thing currently and is completely unambiguous. How do you propose to keep backwards compatibility with that while adding the versions like you showed?

@ianlancetaylor ianlancetaylor changed the title go get to accept git commit hash or tag cmd/go: accept git commit hash or tag in go get Sep 19, 2017
@ianlancetaylor ianlancetaylor added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Sep 19, 2017
@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Sep 19, 2017
@ror6ax
Copy link
Author

ror6ax commented Sep 19, 2017 via email

@mvdan
Copy link
Member

mvdan commented Sep 19, 2017

Perhaps I'm missing something very obvious, but it seems to me like the syntax is still ambiguous. In the original post you mentioned tags as well as hashes. How are you going to discern if a string is a tag or an import path? Note that both can be foo.com/bar.

@OneOfOne
Copy link
Contributor

or you can use git submodules.

@ror6ax ror6ax closed this as completed Oct 4, 2017
@MauroMombelli
Copy link

MauroMombelli commented Nov 10, 2017

The lack of this ability make impossible to install older version without becoming crazy.

My use case: i need to install https://github.com/google/cloud-print-connector
But go 1.9 give segmentation fault, so i installed go 1.8, but the projet is using 1.9 in the last version.
Result:
i cant install what i need, and I blame go. Twice.

BTW totally ok to support commit hash only if that is the issue. Somethng is way better than nothing

@ianlancetaylor
Copy link
Contributor

@MauroMombelli This issue is closed, for good reasons. There are some alternatives suggested above. Another is to run go get and then cd DIR; git checkout REV.

@OneOfOne
Copy link
Contributor

@MauroMombelli if you don't feel like using dep, I wrote a little tool for that https://github.com/OneOfOne/git-go-vendor, you should be vendoring your deps one way or the other anyway.

@MauroMombelli
Copy link

@ianlancetaylor is not checking out the correct version, is to make it complile with all dependency and such. I bring as example the https://github.com/google/cloud-print-connector, a official google product that break and i wanted to have.

@OneOfOne i would like to use it, but i tried some combinantion of parameter before giving up in frustration. I understand the "compile by yourself", but the "handle the dependency fun".. no thank you. I tryed to use another tool that supposely would give you a specific tag, but unfortunately it seems to use a different versioning schema that the project liked, thus making the build unsuccessfully.

@ianlancetaylor
Copy link
Contributor

@MauroMombelli This issue is closed and will not be reopened. If you want to discuss this further, please use a forum; see https://golang.org/wiki/Questions. Thanks.

@johndpope
Copy link

johndpope commented Jan 17, 2018

glide seems to be path forward
after installing glide

  • just run glide init
    just edit glide.yaml
    screen shot 2018-01-17 at 2 31 25 pm
    then glide update

@mvdan
Copy link
Member

mvdan commented Jan 17, 2018

Again, this issue is closed - please use one of the forums mentioned by @ianlancetaylor above to continue the discussion, or open a new issue if you have a specific proposal or suggestion in mind.

@golang golang locked and limited conversation to collaborators Jan 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. package-management
Projects
None yet
Development

No branches or pull requests

8 participants