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: add go get revision option #22859

Closed
ror6ax opened this issue Nov 23, 2017 · 5 comments
Closed

cmd/go: add go get revision option #22859

ror6ax opened this issue Nov 23, 2017 · 5 comments

Comments

@ror6ax
Copy link

ror6ax commented Nov 23, 2017

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)?

amd64

What did you do?

go get github.com/link/to-lib-with-currently -broken-master

What did you expect to see?

go get github.com/link/to-lib-with-currently -broken-master --rev stable_git_revision_hash

I'm raising this again as I see more and more cases where I simply can't build a project becouse someone, somewhere in other part of the world sneezed at their last commit.

glide/go dep is not an answer to every case . If I can, I do use it, but if I can't - I'm in for exciting tour of cd'ing and git checkout'ing my libs and all the problems that come with it done manually.

Adding one optional parameter is not breaking backward compatibility, but it will save a lot of time and nerves for loads of people.

@cznic
Copy link
Contributor

cznic commented Nov 23, 2017

  1. Don't import packages that break unreasonably.
  2. If that's not an option, fork the package and import your stable fork instead.

@ALTree
Copy link
Member

ALTree commented Nov 23, 2017

I don't have an opinion on this, but I think that you should definitely expand on:

glide/go dep is not an answer to every case .

If you show a concrete example of a situation that cannot be solved by using e.g. dep, but can be solved by adding a --rev flag to go get, you'll minimize the chances of someone just replying "just use dep", like it happened the last time you asked for this. I note that dep allows to force a specific revision field for a dependency.

@ALTree ALTree changed the title Add go get revision option cmd/go: add go get revision option Nov 23, 2017
@mvdan
Copy link
Member

mvdan commented Nov 23, 2017

Arguing that there's no harm in adding an extra flag is not entirely true - once added and released, we're stuck with it in Go1 (and a future Go2 too, potentially). It is also unclear whether Go should be encouraging such practices - for now, it seems to be opinionated against pinning specific versions when simply "getting" a package.

Also worth noting that some replies and alternatives were given in the original thread (#21933), but it was closed without any of them being discussed or argued against.

Edit: I was wrong to assume that the command-line tools fall under the Go1 compatibility guarantee. But even so, removing or changing a flag can still cause problems and inconveniences to users, which should be avoided whenever possible.

@ror6ax
Copy link
Author

ror6ax commented Nov 23, 2017

dep, as any "file-based" soultion has a problem that if it's not originally in the repo, I get diverging git history the moment I need to fix some version somewhere. I don't see it used by Hashicorp, which is a showstopper for me. I don't see it used much at all, for that matter. Also, go dep is not exactly stable, look at it's issue list.

Being opinionated against having a version is a strange thing for me, to be honest. What good does it bring? If you want "latest code only" behavior, why are branches an option then? Anyway, it's just not clear to many people. If you guys still decide to leave it as it is - at least write some verbose explanation why is this solution chosen so we don't restart the conversation.

Again, I want to bring the point home - one flag is not going to break anything. It will only trigger checkout, there's not much code to maintain there. If it's broken - well, you roll back to current behavior. v1 or v2, it's just a bit of wrapper "sugar".

@ianlancetaylor
Copy link
Contributor

Closing in favor of the versioning work in #24301.

@golang golang locked and limited conversation to collaborators Mar 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants