From 480defab689610550ee3d346e31441a2bb881fcb Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 15 Jun 2020 12:02:19 -0700 Subject: [PATCH] fix: override GOFLAGS That way we can combine our GOFLAGS with the user specified ones. This also switches to the new -trimpath build flag for reproducible builds. fixes #7475 --- mk/golang.mk | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mk/golang.mk b/mk/golang.mk index 73073370194..5d70f02baed 100644 --- a/mk/golang.mk +++ b/mk/golang.mk @@ -6,12 +6,13 @@ export GO111MODULE=on # pre-definitions GOCC ?= go GOTAGS ?= -unexport GOFLAGS -GOFLAGS ?= GOTFLAGS ?= +# Unexport GOFLAGS so we only apply it where we actually want it. +unexport GOFLAGS # Try to make building as reproducible as possible by stripping the go path. -GOFLAGS += "-asmflags=all='-trimpath=$(GOPATH)'" "-gcflags=all='-trimpath=$(GOPATH)'" +# Override so we can combine with the user's go flags. +override GOFLAGS += -trimpath ifeq ($(tarball-is),1) GOFLAGS += -mod=vendor