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

drive version should report git's short commit hash #138

Closed
l3iggs opened this issue Mar 31, 2015 · 10 comments
Closed

drive version should report git's short commit hash #138

l3iggs opened this issue Mar 31, 2015 · 10 comments

Comments

@l3iggs
Copy link

l3iggs commented Mar 31, 2015

No description provided.

@l3iggs l3iggs changed the title ´drive version´ should report git's short commit hash drive version should report git's short commit hash Mar 31, 2015
@odeke-em
Copy link
Owner

I don't know what to think about this, this will be coupling too much of git with drive of which I might be bound to forget during dev. Might be helpful for debugging otherwise.

@l3iggs
Copy link
Author

l3iggs commented Mar 31, 2015

One example of another project that does this is docker:

$ docker version
Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.1
Git commit (client): a8a31ef
OS/Arch (client): linux/amd64
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.4.1
Git commit (server): a8a31ef

@odeke-em
Copy link
Owner

For sure. I'll have to hard code it, which is what I am worried about forgetting.

@odeke-em
Copy link
Owner

Never mind my last comment, I think I've conjured a way to solve this without any hard coding . I'll do this when I get back home.

@odeke-em
Copy link
Owner

odeke-em commented Apr 2, 2015

Please checkout PR #144

@kcwu
Copy link

kcwu commented Apr 4, 2015

The git hash reported by 'drive about' is dynamically detected.
I mean, the hash is not related to the running binary.

For example,

  1. run 'drive about'
  2. git pull # get new code, but don't build
  3. run 'drive about' again

The result git hash of step 1 and 3 are different. But the 'drive' binary actually doesn't change. This may give misleading information for advanced users.

docker solves this problem using additional build script.
https://github.com/docker/docker/blob/master/hack/make/.go-autogen

For pure go solution, https://blog.golang.org/generate may be useful. However, it requires go 1.4

@odeke-em
Copy link
Owner

odeke-em commented Apr 4, 2015

That is true, it just selects the most recent hash. For starters, the average user (at least from the interactions I've had) will not be building drive frequently. Thank you, I'll take a look at Docker's solution

@odeke-em
Copy link
Owner

odeke-em commented Apr 4, 2015

Just saw Docker's solution: ahaha I had an initial solution exactly like theirs before but figured it would not work for our build currently.

See none of those solutions will work directly. Another solution that I had was a packager for drive, that would build the binary and get the hash right then.

@odeke-em odeke-em mentioned this issue Apr 15, 2015
@odeke-em
Copy link
Owner

Please help me take a look at #151, if you can.
Thank you.

@odeke-em
Copy link
Owner

odeke-em commented May 2, 2015

You can now do

$ go get github.com/odeke-em/drive/drive-gen && drive-gen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants