cmd/go: value of -buildmode in buildinfo can differ from what is used in build ID #63559
Labels
GoCommand
cmd/go
help wanted
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Built two binaries from identical source code, passing
-buildmode=default
to the first and-buildmode=exe
to the second.What did you expect to see?
Both binaries should be identical and have the same hash.
What did you see instead?
The binaries hashes differed, though using
xbindiff
showed that the build ID was the only difference between them. It seems that the buildmode that is actually used is included in binaries build information (exe
in both cases), but the exact value of-buildmode
as passed togo build
is used when creating the build ID. To make reproducing binaries easier I think the same buildmode value that is used in the embedded build information should be used when creating the build ID.Currently it can be very difficult to tell what value of
-buildmode
was passed at build time when you only have a Go binary and no information on its build process. This change would make it easier to reproduce Go binaries using the embedded build information as a guide.The text was updated successfully, but these errors were encountered: