Skip to content

Commit

Permalink
Add trimpath Go build flag
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
HeavyWombat committed Feb 3, 2021
1 parent 6d8f56e commit 1fce4e8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GOCACHE ?= $(shell echo ${PWD})/$(OUTPUT_DIR)/gocache
# golang target architecture
GOARCH ?= amd64
# golang global flags
GO_FLAGS ?= -v -mod=vendor
GO_FLAGS ?= -v -mod=vendor -trimpath

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

0 comments on commit 1fce4e8

Please sign in to comment.