[Buildroot] [git commit] package/pkg-golang: enable trimpath option for reproducible builds

Peter Korsgaard peter at korsgaard.com
Sun Dec 8 07:40:48 UTC 2019


commit: https://git.buildroot.net/buildroot/commit/?id=687230730dfb2bab9a54506867786c0bd1b985f1
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

The -trimpath option (introduced in go 1.13) removes absolute build paths
from the target binary.  This results in more consistent / reproducible
builds across different systems with varying paths to Buildroot.

Signed-off-by: Christian Stewart <christian at paral.in>
[Peter: mention that this is a go 1.13+ feature]
Signed-off-by: Peter Korsgaard <peter at korsgaard.com>
---
 package/pkg-golang.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/pkg-golang.mk b/package/pkg-golang.mk
index e47de17aba..2494ce028c 100644
--- a/package/pkg-golang.mk
+++ b/package/pkg-golang.mk
@@ -61,6 +61,7 @@ $(2)_WORKSPACE ?= _gopath
 $(2)_BUILD_OPTS += \
 	-ldflags "$$($(2)_LDFLAGS)" \
 	-tags "$$($(2)_TAGS)" \
+	-trimpath \
 	-p $(PARALLEL_JOBS)
 
 # Target packages need the Go compiler on the host.


More information about the buildroot mailing list