Skip to content

Commit ada20c0

Browse files
authored
build: make go buildid static (#30342)
The previous clearing of buildid did fully work, turns out we need to set it in `ldflags` The go buildid is the only remaining hurdle for reproducible builds, see #28987 (comment) This PR changes the go build id application note to say literally `none` golang/go#33772 (comment): > This difference is due to the .note.go.buildid section added by the linker. It can be set to something static e.g. -ldflags=-buildid= (empty string) to gain reproducibility.
1 parent 941ae33 commit ada20c0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

build/ci.go

+4
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,10 @@ func doInstall(cmdline []string) {
237237
// buildFlags returns the go tool flags for building.
238238
func buildFlags(env build.Environment, staticLinking bool, buildTags []string) (flags []string) {
239239
var ld []string
240+
// See https://github.com/golang/go/issues/33772#issuecomment-528176001
241+
// We need to set --buildid to the linker here, and also pass --build-id to the
242+
// cgo-linker further down.
243+
ld = append(ld, "--buildid=none")
240244
if env.Commit != "" {
241245
ld = append(ld, "-X", "github.com/ethereum/go-ethereum/internal/version.gitCommit="+env.Commit)
242246
ld = append(ld, "-X", "github.com/ethereum/go-ethereum/internal/version.gitDate="+env.Date)

0 commit comments

Comments
 (0)