[master,kirkstone,2/2] go.bbclass: disable the use of the default configuration file

Message ID 20220426035909.26021-2-Qi.Chen@windriver.com
State Accepted, archived
Commit 711b41744ab08ee62c71cdccca335a7828ec0ba1
Headers show
Series [master,kirkstone,1/2] cases/buildepoxy.py: fix typo | expand

Commit Message

ChenQi April 26, 2022, 3:59 a.m. UTC
We need to disable the use the default configuration file. This is
to ensure that user settings do not mess things up when building go
recipes.

For example, if I set 'GOBIN=./relative/path' in $HOME/.config/go/env,
then go-runtime fails to build with error like below:

  cannot install, GOBIN must be an absolute path

According to `go help environment',
"""
Setting GOENV=off in the environment disables the use of the default
configuration file.
"""

We can explicitly disable the configuration file by setting GOENV to off.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/classes/go.bbclass | 1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index df8d4db26d..1a9a0bc1d4 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -68,6 +68,7 @@  GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/"
 
 B = "${WORKDIR}/build"
 export GOPATH = "${B}"
+export GOENV = "off"
 export GOTMPDIR ?= "${WORKDIR}/build-tmp"
 GOTMPDIR[vardepvalue] = ""