Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/go: git export-subst causes hash mismatches #27153
What version of Go are you using (
Looks like the SHAs are different:
I then unpacked the zips and did a diff:
This hash fragment is a format string in the source code but apparently gets replaced when
Indeed when I use
This is great that the hash is doing its job and pointing out source code differences. I for sure will upgrade the outdated git. I'm wondering if this is the desired end user behaviour though. Shouldn't
Just adding a couple of snippets (slightly expanding out what @jasonkeene commented on):
And from https://git-scm.com/docs/gitattributes:
changed the title
Hashes for the same pseudo-version differ between machines
Aug 23, 2018
I'm not sure that this is actually a problem for
If the main source of instability is git's abbreviation algorithm, is there some way to specify abbreviation parameters explicitly, or to disable abbreviation altogether?
I'm not sure
gitVersion string = "v0.0.0-master+$Format:%h$"
is turned into this:
gitVersion string = "v0.0.0-master+0ec73abb"
This seems like behaviour that is undesierable. If I run:
go get module@sha1
I would expect to get the exact same source code for that SHA1. Instead I get
The situation that I ran into was
I agree that for the sake of reproducibility and consistency we should use the source as it is checked out, not depend on a post-processing step that is both uncommon and undeterministic, so I'd favor
It's a bit unfortunate that the GitHub-generated zip files will differ, but it's my understanding that we don't use those anymore?