[Buildroot] [git commit branch/next] package/pkg-golang: use package go env for download step

Yann E. MORIN yann.morin.1998 at free.fr
Sun Dec 4 17:29:08 UTC 2022


commit: https://git.buildroot.net/buildroot/commit/?id=cd95a33511b9d9de6f6885ec75e6f39608238b9d
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/next

Currently package secific go env is used only during package build step.

Go vendering is done during the download step and it's sometimes required
to specify package secific go env also for this step.

For example, when importing custom go modules who are hosted on a private
host, it’s required to set GOPRIVATE to avoid public sum checking.

Of all the environment variables driving the behaviour of the go command
[0], there is none that obviously have an impact on the behaviour of
go-mod, unless they are explicitly listed as such [1], so it seems
pretty safe to include the generic environment variables for the
download step.

[0] https://pkg.go.dev/cmd/go#hdr-Environment_variables
[1] https://go.dev/ref/mod#environment-variables

Signed-off-by: Patrick Gerber <pge at ik.me>
[yann.morin.1998 at free.fr: add [0] and [1] and corresponding blurb]
Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
---
 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..cdc67b32c0 100644
--- a/package/pkg-golang.mk
+++ b/package/pkg-golang.mk
@@ -87,7 +87,8 @@ $(2)_POST_PATCH_HOOKS += $(2)_GEN_GOMOD
 $(2)_DOWNLOAD_POST_PROCESS = go
 $(2)_DL_ENV += \
 	$$(HOST_GO_COMMON_ENV) \
-	GOPROXY=direct
+	GOPROXY=direct \
+	$$($(2)_GO_ENV)
 
 # Due to vendoring, it is pretty likely that not all licenses are
 # listed in <pkg>_LICENSE.



More information about the buildroot mailing list