Skip to content

Commit 1fce4e8

Browse files
committed
Add trimpath Go build flag
I recently learned of the `-trimpath` flag for Go builds. It will remove build system specific file paths from the created Go binary. This seems to be a best practice for reproducible builds as a build from my local machine yields the same binary as the build from Travis and any other future build infrastructure. Add `-trimpath` to the default Go flags.
1 parent 6d8f56e commit 1fce4e8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ GOCACHE ?= $(shell echo ${PWD})/$(OUTPUT_DIR)/gocache
1010
# golang target architecture
1111
GOARCH ?= amd64
1212
# golang global flags
13-
GO_FLAGS ?= -v -mod=vendor
13+
GO_FLAGS ?= -v -mod=vendor -trimpath
1414

1515
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
1616
ifeq (,$(shell go env GOBIN))

0 commit comments

Comments
 (0)