From 8dc1947ba8d7ce4769939cc0b8f99c53107b8370 Mon Sep 17 00:00:00 2001 From: Ryan McKern Date: Wed, 3 Jan 2024 17:36:40 -0800 Subject: [PATCH] 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. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7c9256f..8577ef6 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ ifndef VERSION_REF VERSION_REF ?= $(shell git describe --tags --always --dirty="-dev") endif -LDFLAGS := -ldflags='-s -w -X "main.VersionRef=$(VERSION_REF)"' +LDFLAGS := -ldflags='-linkmode "external" -extldflags "-static" -s -w -X "main.VersionRef=$(VERSION_REF)"' export GOFLAGS := -trimpath GOFILES = $(shell find . -iname '*.go' | grep -v -e vendor -e _modules -e _cache -e /data/)