summaryrefslogtreecommitdiff
path: root/guix/scripts/import/go.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-01-25 22:07:13 -0500
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-01-25 22:07:13 -0500
commit1a5302435ff0d2822b823f5a6fe01faa7a85c629 (patch)
treeac7810c88b560532f22d2bab2e59609cd7305c21 /guix/scripts/import/go.scm
parent3ff2ac4980dacf10087e4b42bd9fbc490591900c (diff)
parent070b8a893febd6e7d8b2b7c8c4dcebacf7845aa9 (diff)
Merge branch 'master' into staging.
With "conflicts" solved (all in favor of master except git) in: gnu/local.mk gnu/packages/databases.scm gnu/packages/glib.scm gnu/packages/gnome.scm gnu/packages/gnupg.scm gnu/packages/gnuzilla.scm gnu/packages/graphics.scm gnu/packages/gstreamer.scm gnu/packages/gtk.scm gnu/packages/linux.scm gnu/packages/machine-learning.scm gnu/packages/networking.scm gnu/packages/polkit.scm gnu/packages/pulseaudio.scm gnu/packages/rpc.scm gnu/packages/rust.scm gnu/packages/version-control.scm gnu/packages/w3m.scm
Diffstat (limited to 'guix/scripts/import/go.scm')
-rw-r--r--guix/scripts/import/go.scm69
1 files changed, 35 insertions, 34 deletions
diff --git a/guix/scripts/import/go.scm b/guix/scripts/import/go.scm
index f5cfea8683..f1970d3543 100644
--- a/guix/scripts/import/go.scm
+++ b/guix/scripts/import/go.scm
@@ -87,37 +87,38 @@ that are not yet in Guix"))
(parse-command-line args %options (list %default-options)
#:build-options? #f))
- (let* ((opts (parse-options))
- (args (filter-map (match-lambda
- (('argument . value)
- value)
- (_ #f))
- (reverse opts)))
- ;; Append the full version to the package symbol name when using
- ;; pinned versions.
- (package->definition* (if (assoc-ref opts 'pin-versions?)
- (cut package->definition <> 'full)
- package->definition)))
- (match args
- ((spec) ;e.g., github.com/golang/protobuf@v1.3.1
- (receive (name version)
- (package-name->name+version spec)
- (let ((arguments (list name
- #:goproxy (assoc-ref opts 'goproxy)
- #:version version
- #:pin-versions?
- (assoc-ref opts 'pin-versions?))))
- (if (assoc-ref opts 'recursive)
- ;; Recursive import.
- (map package->definition*
- (apply go-module-recursive-import arguments))
- ;; Single import.
- (let ((sexp (apply go-module->guix-package* arguments)))
- (unless sexp
- (leave (G_ "failed to download meta-data for module '~a'.~%")
- name))
- (package->definition* sexp))))))
- (()
- (leave (G_ "too few arguments~%")))
- ((many ...)
- (leave (G_ "too many arguments~%"))))))
+ (with-error-handling
+ (let* ((opts (parse-options))
+ (args (filter-map (match-lambda
+ (('argument . value)
+ value)
+ (_ #f))
+ (reverse opts)))
+ ;; Append the full version to the package symbol name when using
+ ;; pinned versions.
+ (package->definition* (if (assoc-ref opts 'pin-versions?)
+ (cut package->definition <> 'full)
+ package->definition)))
+ (match args
+ ((spec) ;e.g., github.com/golang/protobuf@v1.3.1
+ (receive (name version)
+ (package-name->name+version spec)
+ (let ((arguments (list name
+ #:goproxy (assoc-ref opts 'goproxy)
+ #:version version
+ #:pin-versions?
+ (assoc-ref opts 'pin-versions?))))
+ (if (assoc-ref opts 'recursive)
+ ;; Recursive import.
+ (map package->definition*
+ (apply go-module-recursive-import arguments))
+ ;; Single import.
+ (let ((sexp (apply go-module->guix-package* arguments)))
+ (unless sexp
+ (leave (G_ "failed to download meta-data for module '~a'.~%")
+ name))
+ (package->definition* sexp))))))
+ (()
+ (leave (G_ "too few arguments~%")))
+ ((many ...)
+ (leave (G_ "too many arguments~%")))))))