diff --git a/mk/golang.mk b/mk/golang.mk index 73073370194..210af085991 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 +# Override so we can combine with the user's go flags. # Try to make building as reproducible as possible by stripping the go path. -GOFLAGS += "-asmflags=all='-trimpath=$(GOPATH)'" "-gcflags=all='-trimpath=$(GOPATH)'" +override GOFLAGS += "-asmflags=all='-trimpath=$(GOPATH)'" "-gcflags=all='-trimpath=$(GOPATH)'" ifeq ($(tarball-is),1) GOFLAGS += -mod=vendor