Skip to content

Commit d70d04f

Browse files
committed
zero out the build id for reproducible builds
We have been having issues with making builds reproducible, especially with the `.note.go.buildid` ELF section. One tip from a golang issue was to set `-ldflags=-buildid=` which seems to work well. You can confirm that the buildid is set to empty by inspecting the binaries with the go command example `go tool buildid _output/local/go/bin/kubectl` Signed-off-by: Davanum Srinivas <[email protected]>
1 parent 84dc704 commit d70d04f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

hack/lib/golang.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ kube::golang::build_binaries() {
784784
# Disable SC2153 for this, as it will throw a warning that the local
785785
# variable goldflags will exist, and it suggest changing it to this.
786786
# shellcheck disable=SC2153
787-
goldflags="${GOLDFLAGS=-s -w} $(kube::version::ldflags)"
787+
goldflags="${GOLDFLAGS=-s -w -buildid=} $(kube::version::ldflags)"
788788
goasmflags="-trimpath=${KUBE_ROOT}"
789789
gogcflags="${GOGCFLAGS:-} -trimpath=${KUBE_ROOT}"
790790

0 commit comments

Comments
 (0)