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
Steven Allen committed
Jun 15, 2020 at 12:02 UTC
480defab689610550ee3d346e31441a2bb881fcb
1 file changed
+4
-3
mk/golang.mk
+4
-3
@@ -6,12 +6,13 @@ export GO111MODULE=on
6
# pre-definitions
7
GOCC ?= go
8
GOTAGS ?=
9
-unexport GOFLAGS
10
-GOFLAGS ?=
9
GOTFLAGS ?=
10
11
+# Unexport GOFLAGS so we only apply it where we actually want it.
12
+unexport GOFLAGS
13
# Try to make building as reproducible as possible by stripping the go path.
14
-GOFLAGS += "-asmflags=all='-trimpath=$(GOPATH)'" "-gcflags=all='-trimpath=$(GOPATH)'"
14
+# Override so we can combine with the user's go flags.
15
+override GOFLAGS += -trimpath
16
17
ifeq ($(tarball-is),1)
18
GOFLAGS += -mod=vendor