[Buildroot] [git commit branch/2022.02.x] package/pkg-golang: disable version control information

Peter Korsgaard peter at korsgaard.com
Sat Mar 4 11:27:49 UTC 2023


commit: https://git.buildroot.net/buildroot/commit/?id=500cc1f46f048febd6fe3dd2c3a5e61f9926dbec
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/2022.02.x

By default go tries to include version control (VCS) information in
binaries. Since Buildroot separates version control from the build
process it is sensible to disable this behavior.

This avoids build errors when building with a git repository higher
up in the tree owned by root. In this case the go build system
calls `git status --porcelain` which returns with an error:
fatal: detected dubious ownership in repository at '/build'

Signed-off-by: Stefan Agner <stefan at agner.ch>
Reviewed-by: Christian Stewart <christian at paral.in>
Signed-off-by: Arnout Vandecappelle <arnout at mind.be>
(cherry picked from commit c3a1f0fe1b912727bb7b5baebe938f75036e566b)
Signed-off-by: Peter Korsgaard <peter at korsgaard.com>
---
 package/pkg-golang.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/pkg-golang.mk b/package/pkg-golang.mk
index 0b3dc3d32f..775633190e 100644
--- a/package/pkg-golang.mk
+++ b/package/pkg-golang.mk
@@ -45,7 +45,8 @@ $(2)_BUILD_OPTS += \
 	-modcacherw \
 	-tags "$$($(2)_TAGS)" \
 	-trimpath \
-	-p $$(PARALLEL_JOBS)
+	-p $$(PARALLEL_JOBS) \
+	-buildvcs=false
 
 # Target packages need the Go compiler on the host at download time (for
 # vendoring), and at build and install time.



More information about the buildroot mailing list