Subject: Re: bug#61885: `guix import go` fails outside of pre-inst-env

From: Josselin Poiret <[email-masked]>
Date: Wed, 01 Mar 2023 10:47:07 +0100

Hi,

winter--- via Bug reports for GNU Guix <[email-masked]> writes:

> Hi,
>
> As of commit ec8c7370dfd66136f7cb517d31fa6fda31e2cb74, the following `guix import` invocation fails:
>
> $ guix import go --recursive github.com/tdewolff/minify/v2
> [...]
> In gnu/packages/check.scm:
>  1037:13  1 (_)
> In ice-9/boot-9.scm:
>  1685:16  0 (raise-exception _ #:continuable? _)
>
> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> error: go-github-com-robfig-cron: unbound variable

This is way worse: (gnu packages golang) cannot be loaded at all!
This is caused by a cycle, (gnu packages golang) uses (gnu packages
check) and vice-versa, and go-github-com-robfig-cron is defined in (gnu
packages golang)! So depending on whether you first use (gnu packages
check) or (gnu packages golang), go-github-com-robfig-cron will not have
been defined yet, hence the error.

Using (gnu packages check) then (gnu packages golang) doesn't make the
error appear.  The solution imo, esp. since (gnu packages check) already
uses (gnu packages golang), is to have the variant package defined
alongside the parent. Here is a patch that should fix this.

Best,
-- 
Josselin Poiret