I can’t for the life of me figure out reproducible builds in Go.

VER=$(go generate); CGO_ENABLED=0 go build -a -ldflags "-s -w -buildid= -X main.version=$VER"

is supposed to give me identical binaries as long as GOOS, GOARCH, go version, and go generate output remain the same, right?

Somehow, when I run it on my laptop, I get a binary that differs from what Github Actions build…

UPD: Forgot -trimpath, how lame!


Comments can be sent as webmentions or by email.