release.bash: support reproducible builds

Manually specifying the "-buildid" removes the last source of variability
when the release binaries is built on one system or another.

See https://github.com/golang/go/issues/33772#issuecomment-528176001

Change-Id: Ibc9b8e99b5b76719735942a510570bcbf96dfea6
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/193498
Reviewed-by: Damien Neil <dneil@google.com>
This commit is contained in:
Joe Tsai 2019-09-04 22:50:42 -07:00
parent 4b3a82f6b1
commit 576cfb3dae

View File

@ -394,7 +394,7 @@ func mustHandleFlags(t *testing.T) {
// Build the binary.
cmd := command{Env: append(os.Environ(), "GOOS="+goos, "GOARCH="+goarch)}
cmd.mustRun(t, "go", "build", "-trimpath", "-ldflags", "-s -w", "-o", binPath, "./cmd/protoc-gen-go")
cmd.mustRun(t, "go", "build", "-trimpath", "-ldflags", "-s -w -buildid=", "-o", binPath, "./cmd/protoc-gen-go")
// Archive and compress the binary.
in, err := ioutil.ReadFile(binPath)