Subject: Re: bug#49202: guix import go type error (failed regex match?)

From: Sarah Morgensen <[email-masked]>
Date: Wed, 18 Aug 2021 22:25:09 -0700

Hi,

Maxim Cournoyer <[email-masked]> writes:

> So we're down to:
>
> $ guix import go github.com/cockroachdb/cockroach-go
> Backtrace:
>            9 (primitive-load "/home/maxim/.config/guix/current/bin/guix")
> In guix/ui.scm:
>    2185:7  8 (run-guix . _)
>   2148:10  7 (run-guix-command _ . _)
> In guix/scripts/import.scm:
>    120:11  6 (guix-import . _)
> In guix/scripts/import/go.scm:
>    115:27  5 (guix-import-go . _)
> In guix/import/go.scm:
>    531:18  4 (go-module->guix-package _ #:goproxy _ #:version _ #:pin-versions? _)
> In guix/git.scm:
>     247:4  3 (update-cached-checkout _ #:ref _ #:recursive? _ #:check-out? _ #:starting-commit _ # _ # _)
>    236:18  2 (resolve _)
> In git/reference.scm:
>      60:8  1 (_ _ _)
> In git/bindings.scm:
>      77:2  0 (raise-git-error _)

This one is happening because the go.mod served by pkg.go.dev reports
that the module version is "2.0.1+incompatible".  This is because the
proper import path is "github.com/cockroachdb/cockroach-go/v2" as the
first line of the project's go.mod states.  An import for that path is
successful.

>
> $ guix import go dmitri.shuralyov.com/gpu/mtl
> Backtrace:
>            5 (primitive-load "/home/maxim/.config/guix/current/bin/guix")
> In guix/ui.scm:
>    2185:7  4 (run-guix . _)
>   2148:10  3 (run-guix-command _ . _)
> In guix/scripts/import.scm:
>    120:11  2 (guix-import . _)
> In guix/scripts/import/go.scm:
>    115:27  1 (guix-import-go . _)
> In guix/import/go.scm:
>    615:19  0 (go-module->guix-package "dmitri.shuralyov.com/gpu/mtl" #:goproxy _ #:version _ # _)
>
> guix/import/go.scm:615:19: In procedure go-module->guix-package:
> In procedure struct-vtable: Wrong type argument in position 1 (expecting struct): #f

This one is happening because the url

   "dmitri.shuralyov.com/gpu/mtl?go-get=1"

which is used to determine the VCS type and location, does not actually
have the headers it is supposed to (instead, they are written in text on
the body of the page...)  It should be addressed upstream, but we should
also have a better error than a backtrace.

> Thanks,
> Maxim