From 10ffb84b3608de1e86357441c109d162a8e8e8f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Batuhan=20Apayd=C4=B1n?= Date: Fri, 11 Feb 2022 17:34:29 +0300 Subject: [PATCH] feat: add bunch of ldflags for reproducibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Batuhan Apaydın --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5eabecb..9fe244a 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ else BUILD_DATE ?= $(shell date $(DATE_FMT)) endif PKG=github.com/hashicorp/vault-csi-provider/internal/version -LDFLAGS?="-X '$(PKG).BuildVersion=$(VERSION)' \ +LDFLAGS?="-buildid= -s -w -extldflags=-zrelro -extldflags=-znow -X '$(PKG).BuildVersion=$(VERSION)' \ -X '$(PKG).BuildDate=$(BUILD_DATE)' \ -X '$(PKG).GoVersion=$(shell go version)'" K8S_VERSION?=v1.22.2 @@ -41,6 +41,10 @@ lint: build: CGO_ENABLED=0 go build \ + -trimpath \ + -buildmode=pie \ + -mod=readonly \ + -modcacherw \ -ldflags $(LDFLAGS) \ -o dist/ \ .