From: Christian Lindeberg <christian.lindeb...@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 downloading and
unpacking module dependencies to the module cache.
Also, clean out the module cache before unpacking.

Signed-off-by: Christian Lindeberg <christian.lindeb...@axis.com>
---

Changes in V2:
- Fix assumption on S regarding the number of directory levels below
  WORKDIR. Suggested by Peter Kjellerstedt.

 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..2083d7f2d1 100644
--- a/meta/classes-recipe/go-mod.bbclass
+++ b/meta/classes-recipe/go-mod.bbclass
@@ -22,9 +22,9 @@ GOBUILDFLAGS:append = " -modcacherw"
 
 inherit go
 
+export GOMODCACHE = "${S}/pkg/mod"
+GO_MOD_CACHE_DIR = "${@os.path.relpath(d.getVar('GOMODCACHE'), 
d.getVar('WORKDIR'))}"
+do_unpack[cleandirs] += "${GOMODCACHE}"
+
 GO_WORKDIR ?= "${GO_IMPORT}"
 do_compile[dirs] += "${B}/src/${GO_WORKDIR}"
-
-export GOMODCACHE = "${B}/.mod"
-
-do_compile[cleandirs] += "${B}/.mod"
-- 
2.39.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#204472): 
https://lists.openembedded.org/g/openembedded-core/message/204472
Mute This Topic: https://lists.openembedded.org/mt/108428092/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to