From: Christian Lindeberg <christian.lindeberg@axis.com>
Set the GO_MOD_CACHE_DIR variable and move the location of the module
cache to enable the use of the go module fetchers for module
dependencies.
Also, clean out the module cache before unpacking.
Signed-off-by: Christian Lindeberg <christian.lindeberg@axis.com>
---
meta/classes-recipe/go-mod.bbclass | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/meta/classes-recipe/go-mod.bbclass b/meta/classes-recipe/go-mod.bbclass
index ca3a690d05..71a6712c47 100644
--- a/meta/classes-recipe/go-mod.bbclass
+++ b/meta/classes-recipe/go-mod.bbclass
@@ -22,9 +22,9 @@ GOBUILDFLAGS:append = " -modcacherw"
inherit go
+GO_MOD_CACHE_DIR ?= "${@os.path.join(os.path.basename(d.getVar('S')), 'pkg/mod')}"
+export GOMODCACHE = "${@os.path.join(os.path.dirname(d.getVar('S')), d.getVar('GO_MOD_CACHE_DIR'))}"
Using the default [1] bitbake S = "${WORKDIR}/${BP}" config, I think this will be equal to:
GO_MOD_CACHE_DIR ?= "${BP}/pkg/mod"
export GOMODCACHE = "${WORKDIR}/${BP}/pkg/mod"
in the end this can be written as:
export GOMODCACHE ?= "${S}/pkg/mod"
Is it correct or am I seeing something wrong?