Skip to content

Commit 8dc1947

Browse files
committed
Force extremely static builds
kubeapply links against libc, and there's no guarantee that a runtime environment will match what a given binary was built against. This change will ensure that the resulting binary is completely static and able to operate across libc mismatches.
1 parent ab73469 commit 8dc1947

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ifndef VERSION_REF
22
VERSION_REF ?= $(shell git describe --tags --always --dirty="-dev")
33
endif
44

5-
LDFLAGS := -ldflags='-s -w -X "main.VersionRef=$(VERSION_REF)"'
5+
LDFLAGS := -ldflags='-linkmode "external" -extldflags "-static" -s -w -X "main.VersionRef=$(VERSION_REF)"'
66
export GOFLAGS := -trimpath
77

88
GOFILES = $(shell find . -iname '*.go' | grep -v -e vendor -e _modules -e _cache -e /data/)

0 commit comments

Comments
 (0)