From c5670da69b765c4c16bc663cbfb6777ae98f602f Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Thu, 26 Mar 2026 17:55:14 +0000 Subject: go-mod-vcs.bbclass: handle pure hybrid mode gracefully When a recipe uses only gomod:// fetches with no VCS (git://) modules, GO_MODULE_CACHE_DATA is an empty list. Previously do_create_module_cache would run with nothing to process and do_sync_go_files would fatal with "No modules found in cache". Detect the empty module list and return early with an informational message in both tasks, allowing pure hybrid recipes (like yq) to build without workarounds. Signed-off-by: Bruce Ashfield --- classes/go-mod-vcs.bbclass | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'classes') diff --git a/classes/go-mod-vcs.bbclass b/classes/go-mod-vcs.bbclass index c08894d5..625343ef 100644 --- a/classes/go-mod-vcs.bbclass +++ b/classes/go-mod-vcs.bbclass @@ -818,6 +818,11 @@ python do_create_module_cache() { workdir = Path(d.getVar('WORKDIR')) modules_data = json.loads(d.getVar('GO_MODULE_CACHE_DATA')) + # Pure hybrid mode (all gomod://, no VCS modules) - nothing to do + if not modules_data: + bb.note("No VCS modules to process (pure hybrid mode) - skipping cache creation") + return + # Remove go.sum files from git-fetched dependencies to prevent checksum conflicts # The module checksums from git sources differ from the proxy checksums, and stale # go.sum files in dependencies can cause "checksum mismatch" errors during build @@ -1046,7 +1051,8 @@ python do_sync_go_files() { } if not our_modules: - bb.fatal("No modules found in cache - cannot synchronize go.mod/go.sum") + bb.note("No VCS modules in cache (pure hybrid mode) - skipping go.mod/go.sum sync") + return bb.note(f"Found {len(our_modules)} modules in cache") -- cgit v1.2.3-54-g00ecf