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/dist: Consider using "git describe" for "go version" string #9230

tv42 opened this issue Dec 9, 2014 · 3 comments

cmd/dist: Consider using "git describe" for "go version" string #9230

tv42 opened this issue Dec 9, 2014 · 3 comments


Copy link

@tv42 tv42 commented Dec 9, 2014

The current code for VERSION.cache results in output like

$ go version
go version devel +2937d88 2014-12-09 22:08:45 +0000 linux/amd64

Many git projects use git describe for this. For example, Git itself has which, adjusted to lightweight tags and a different naming convention, would lead to:

$ git describe --tags --match "go[0-9]*" --abbrev=7 HEAD 2>/dev/null

Or even noting uncommitted changes:

$ git describe --tags --match "go[0-9]*" --abbrev=7 --dirty=+ 2>/dev/null

As part of cmd/dist, it could look something like this:

$ go version 
go version devel go1.4beta1-394-g2937d88+ linux/amd64

and this would also seem to make the explicit branch logic in src/cmd/dist/build.c unnecessary, as "git describe" can already look for tags.

This is useful (to me, at least) because it immediately communicates more than just that sha1 in the original; it tells me what tag I'm near, how far away from it I am, it includes the sha1 from earlier, and then can even mark dirty working trees so I know to suspect my build to be tainted.

Copy link

@minux minux commented Dec 9, 2014

I don't think the format of "go version" is going to change.
we tried hard to match the existing format.

Copy link

@tv42 tv42 commented Dec 10, 2014

Why not? Does something really parse the output?

Copy link

@rsc rsc commented Apr 10, 2015

The hash and date seems fine. Not worth changing.

@rsc rsc closed this Apr 10, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.