import: go: Fix import when import path redirects.

* guix/import/go.scm (fetch-module-meta-data): If no meta entries
have a matching import prefix, return the first entry instead of #f.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Sarah Morgensen 2021-08-30 19:05:19 -07:00 committed by Ludovic Courtès
parent af4fa7c00c
commit e8a67f0fc4
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -485,9 +485,12 @@ (define (go-import->module-meta content-text)
(match (select (html->sxml meta-data #:strict? #t))
(() #f) ;nothing selected
((('content content-text) ..1)
(find (lambda (meta)
(string-prefix? (module-meta-import-prefix meta) module-path))
(map go-import->module-meta content-text))))))
(or
(find (lambda (meta)
(string-prefix? (module-meta-import-prefix meta) module-path))
(map go-import->module-meta content-text))
;; Fallback to the first meta if no import prefixes match.
(go-import->module-meta (first content-text)))))))
(define (module-meta-data-repo-url meta-data goproxy)
"Return the URL where the fetcher which will be used can download the