[PATCH] import: go: Fix match-error in 'go-package-description'

  • Done
  • quality assurance status badge
Details
2 participants
  • Björn Höfling
  • Sarah Morgensen
Owner
unassigned
Submitted by
Sarah Morgensen
Severity
normal
S
S
Sarah Morgensen wrote on 24 Jun 2021 00:46
(address . guix-patches@gnu.org)
f23c811302f02704428288f67b4a13a410fedc01.1624488122.git.iskarian@mgsn.dev
* guix/import/go.scm (go-package-description): Make sure description* is
always a list, so the result is properly matched.
---
Hello Guix,

In the process of using `guix import go` I encountered a rare issue when the
go.pkg.dev Documentation and UnitInfo sections for a package are both blank:

Toggle snippet (23 lines)
$ ./pre-inst-env guix import go github.com/neelance/sourcemap
Backtrace:
In ice-9/boot-9.scm:
1752:10 7 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
6 (apply-smob/0 #<thunk 7fd10955ef60>)
In ice-9/boot-9.scm:
724:2 5 (call-with-prompt _ _ #<procedure default-prompt-handle…>)
In ice-9/eval.scm:
619:8 4 (_ #(#(#<directory (guile-user) 7fd109558c80>)))
In guix/ui.scm:
2147:12 3 (run-guix-command _ . _)
In guix/scripts/import.scm:
120:11 2 (guix-import . _)
In guix/scripts/import/go.scm:
118:27 1 (guix-import-go . _)
In guix/import/go.scm:
191:4 0 (go-module->guix-package _ #:goproxy _ #:version _ # _)

guix/import/go.scm:191:4: In procedure go-module->guix-package:
Throw to key `match-error' with args `("match" "no matching pattern" #f)'.

Looks like the error is due to using false where the empty list was expected.
This tiny patch fixes that. Copyright for go.scm was added in

Sarah

guix/import/go.scm | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

Toggle diff (20 lines)
diff --git a/guix/import/go.scm b/guix/import/go.scm
index d110954664..cf8c62abe2 100644
--- a/guix/import/go.scm
+++ b/guix/import/go.scm
@@ -186,8 +186,9 @@ e.g. \"google.golang.org/protobuf/proto\"."
(description (if (not (null? overview))
overview
(select-content sxml)))
- (description* (and (not (null? description))
- (first description))))
+ (description* (if (not (null? description))
+ (first description)
+ description)))
(match description*
(() #f) ;nothing selected
((p elements ...)

base-commit: 1f3d7b45349d43e5cc02594083e0cd44ef730992
--
2.31.1
B
B
Björn Höfling wrote on 28 Jun 2021 08:54
(name . Sarah Morgensen via Guix-patches via)(address . guix-patches@gnu.org)
20210628085458.754e926c@alma-ubu.fritz.box
On Wed, 23 Jun 2021 15:46:46 -0700
Sarah Morgensen via Guix-patches via <guix-patches@gnu.org> wrote:

Toggle quote (4 lines)
> * guix/import/go.scm (go-package-description): Make sure description*
> is always a list, so the result is properly matched.


Pushed as

9d9152425e96c408357d0f4961767a5c08076c13

Thanks,

Björn
-----BEGIN PGP SIGNATURE-----

iF0EAREKAB0WIQQiGUP0np8nb5SZM4K/KGy2WT5f/QUCYNlyQgAKCRC/KGy2WT5f
/f0AAJ4gA33MoA/JQ4yF550L4+n/B9qSugCfVM25Zc5n79eTh9pPYdZbBKJVQPk=
=l4Rf
-----END PGP SIGNATURE-----


?
Your comment

This issue is archived.

To comment on this conversation send an email to 49200@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 49200
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch