From 773579da26c97ebd6e1cff3986487dfb6d6ceed3 Mon Sep 17 00:00:00 2001 From: Christian Lindeberg Date: Fri, 13 Sep 2024 09:29:58 +0200 Subject: [PATCH] go-mod.bbclass: Set GO_MOD_CACHE_DIR 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. (From OE-Core rev: 287daff0bbd877990ce272e10601d4540d71f239) Signed-off-by: Christian Lindeberg Signed-off-by: Richard Purdie --- 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"