diff mbox series

[bug#55242,02/10] guix: import: go: Rename go.pkg.dev-info to pkg.go.dev-info.

Message ID 20220503114301.9524-2-attila@lendvai.name
State New
Headers show
Series [bug#55242,01/10] guix: import: Print the number of packages at the end. | expand

Commit Message

Attila Lendvai May 3, 2022, 11:42 a.m. UTC
To properly mimic the name of the website. Also employ it at one more place.
---
 guix/import/go.scm | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

Comments

M May 3, 2022, 4:22 p.m. UTC | #1
Attila Lendvai schreef op di 03-05-2022 om 13:42 [+0200]:
> github

Standard capitalisation is "GitHub" here, not that it really matters
much.

Greetings,
Maxime.
diff mbox series

Patch

diff --git a/guix/import/go.scm b/guix/import/go.scm
index d00c13475a..bb4bb7bb7b 100644
--- a/guix/import/go.scm
+++ b/guix/import/go.scm
@@ -120,8 +120,11 @@  (define (escape occurrence)
 ;; Prevent inlining of this procedure, which is accessed by unit tests.
 (set! go-path-escape go-path-escape)
 
-(define (go.pkg.dev-info name)
-  (http-fetch* (string-append "https://pkg.go.dev/" name)))
+(define (pkg.go.dev-info module-path)
+  ;; FIXME if MODULE-PATH is a fork on github, then it will try to get the
+  ;; info of the fork (instead of the upstream), which most probably does not
+  ;; exist in pkg.go.dev.  Example: https://github.com/bonitoo-io/oapi-codegen
+  (http-fetch* (string-append "https://pkg.go.dev/" module-path)))
 
 (define* (go-module-version-string goproxy name #:key version)
   "Fetch the version string of the latest version for NAME from the given
@@ -147,7 +150,7 @@  (define* (go-module-available-versions goproxy name)
 (define (go-package-licenses name)
   "Retrieve the list of licenses that apply to NAME, a Go package or module
 name (e.g. \"github.com/golang/protobuf/proto\")."
-  (let* ((body (go.pkg.dev-info (string-append name "?tab=licenses")))
+  (let* ((body (pkg.go.dev-info (string-append name "?tab=licenses")))
          ;; Extract the text contained in a h2 child node of any
          ;; element marked with a "License" class attribute.
          (select (sxpath `(// (* (@ (equal? (class "License"))))
@@ -169,7 +172,7 @@  (define (sxml->texi sxml-node)
 (define (go-package-description name)
   "Retrieve a short description for NAME, a Go package name,
 e.g. \"google.golang.org/protobuf/proto\"."
-  (let* ((body (go.pkg.dev-info name))
+  (let* ((body (pkg.go.dev-info name))
          (sxml (html->sxml body #:strict? #t))
          (overview ((sxpath
                      `(//
@@ -206,8 +209,7 @@  (define (go-package-synopsis module-name)
 the https://pkg.go.dev/ web site."
   ;; Note: Only the *module* (rather than package) page has the README title
   ;; used as a synopsis on the https://pkg.go.dev web site.
-  (let* ((url (string-append "https://pkg.go.dev/" module-name))
-         (body (http-fetch* url))
+  (let* ((body (pkg.go.dev-info module-name))
          ;; Extract the text contained in a h2 child node of any
          ;; element marked with a "License" class attribute.
          (select-title (sxpath