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

Proposal: Make built executables deterministic #32782

Closed
pjebs opened this issue Jun 26, 2019 · 5 comments
Closed

Proposal: Make built executables deterministic #32782

pjebs opened this issue Jun 26, 2019 · 5 comments

Comments

@pjebs
Copy link
Contributor

pjebs commented Jun 26, 2019

Currently when 2 different people build the same code base, the generated Go executable is different. For starters, the individual GOPATH is written when panics are logged.

With Go modules, perhaps this issue can be revisited.
There is definitely value in the same Go code base built for same OS for same ARCH with same version of Go and dependencies should generate EXACTLY the same binary.

@gopherbot gopherbot added this to the Proposal milestone Jun 26, 2019
@cespare
Copy link
Contributor

cespare commented Jun 26, 2019

Go 1.13 will include a -trimpath flag; see #16860. That should make it easier to have fully reproducible builds. #32609 is for writing more documentation about this for the 1.13 release.

@beoran
Copy link

beoran commented Jun 27, 2019

This is important for using Go in safety critical software, where the binaries tested and put into production must be identical. Until now, this meant that a build server was necesary. With 100% reproducible builds, a binary compiled on one machine would be identical to one built on a different one, which is means no build server is needed anymore.

@bcmills
Copy link
Contributor

bcmills commented Jun 27, 2019

Go 1.13 should have exactly the properties you describe when the -trimpath flag is set. If you always want it to be set for any command you run, note that you can set it in the GOFLAGS variable:

$ go env -w GOFLAGS=-trimpath

@bcmills
Copy link
Contributor

bcmills commented Jun 27, 2019

If you find that that is not the case (using go1.13beta1 or gotip), please file a new issue with steps to reproduce.

@bcmills
Copy link
Contributor

bcmills commented Jun 27, 2019

Duplicate of #16860

@bcmills bcmills marked this as a duplicate of #16860 Jun 27, 2019
@bcmills bcmills closed this as completed Jun 27, 2019
@golang golang locked and limited conversation to collaborators Jun 26, 2020
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

5 participants