package/go: set goos variable to linux

This commit fixes a build error when the host environment has GOOS set to
something other than "linux." For example,

cd ./buildroot
GOOS="js" make

This will cause a build failure. Override GOOS to be either empty for host
packages or set to "linux" for target packages.

Signed-off-by: Christian Stewart <christian@paral.in>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
(cherry picked from commit 8c585eb32d)
This commit is contained in:
Christian Stewart 2022-05-20 20:51:30 -07:00 committed by Peter Korsgaard
parent 893271e7db
commit 8ffd527406

View File

@ -71,6 +71,7 @@ endif
HOST_GO_TOOLDIR = $(HOST_GO_ROOT)/pkg/tool/linux_$(GO_GOARCH)
HOST_GO_TARGET_ENV = \
$(HOST_GO_COMMON_ENV) \
GOOS="linux" \
GOARCH=$(GO_GOARCH) \
GOCACHE="$(HOST_GO_TARGET_CACHE)" \
CC="$(TARGET_CC)" \
@ -93,6 +94,7 @@ endif
HOST_GO_CROSS_ENV = \
CC_FOR_TARGET="$(TARGET_CC)" \
CXX_FOR_TARGET="$(TARGET_CXX)" \
GOOS="linux" \
GOARCH=$(GO_GOARCH) \
$(if $(GO_GO386),GO386=$(GO_GO386)) \
$(if $(GO_GOARM),GOARM=$(GO_GOARM)) \
@ -107,6 +109,7 @@ endif # BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
# For the convenience of host golang packages
HOST_GO_HOST_ENV = \
$(HOST_GO_COMMON_ENV) \
GOOS="" \
GOARCH="" \
GOCACHE="$(HOST_GO_HOST_CACHE)" \
CC="$(HOSTCC_NOCCACHE)" \