all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#69512] [PATCH] gnu: Add go-github-com-hashicorp-go-multierror.
@ 2024-03-02 20:31 Artyom V. Poptsov
  2024-03-03 17:51 ` Sharlatan Hellseher
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Artyom V. Poptsov @ 2024-03-02 20:31 UTC (permalink / raw)
  To: 69512


[-- Attachment #1.1: Type: text/plain, Size: 126 bytes --]

Hello,

this patchset adds two packages: "go-github-com-hashicorp-errwrap"[1]
and "go-github-com-hashicorp-go-multierror"[2].

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-Add-go-github-com-hashicorp-errwrap.patch --]
[-- Type: text/x-diff, Size: 2829 bytes --]

From 8ac21911360fa825fc0b13bd58ef64c5c9151ec7 Mon Sep 17 00:00:00 2001
Message-ID: <8ac21911360fa825fc0b13bd58ef64c5c9151ec7.1709411277.git.poptsov.artyom@gmail.com>
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
Date: Sat, 2 Mar 2024 23:25:06 +0300
Subject: [PATCH 1/2] gnu: Add go-github-com-hashicorp-errwrap.

* gnu/packages/golang-xyz.scm (go-github-com-hashicorp-errwrap): New
  variable.

Change-Id: I4a0e7c23f9aaab4e29c81a68d976dafcd86dd2d1
---
 gnu/packages/golang-xyz.scm | 38 +++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/gnu/packages/golang-xyz.scm b/gnu/packages/golang-xyz.scm
index e68948e495..b52753c9bb 100644
--- a/gnu/packages/golang-xyz.scm
+++ b/gnu/packages/golang-xyz.scm
@@ -686,6 +686,44 @@ (define-public go-github-com-gabriel-vasile-mimetype
 @end itemize")
     (license license:expat)))
 
+(define-public go-github-com-hashicorp-errwrap
+  (package
+    (name "go-github-com-hashicorp-errwrap")
+    (version "1.1.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/hashicorp/errwrap")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0p5wdz8p7dmwphmb33gwhy3iwci5k9wkfqmmfa6ay1lz0cqjwp7a"))))
+    (build-system go-build-system)
+    (arguments
+     (list
+      #:import-path "github.com/hashicorp/errwrap"))
+    (home-page "https://github.com/hashicorp/errwrap")
+    (synopsis "Go library for wrapping and querying errors")
+    (description
+     "@code{errwrap} is a package for Go that formalizes the pattern of wrapping
+errors and checking if an error contains another error.
+
+There is a common pattern in Go of taking a returned @code{error} value and then
+wrapping it (such as with @code{fmt.Errorf}) before returning it.  The problem with
+this pattern is that you completely lose the original @code{error} structure.
+
+Arguably the correct approach is that you should make a custom structure implementing
+the @code{error} interface, and have the original error as a field on that structure,
+such as @url{http://golang.org/pkg/os/#PathError, this example}.  This is a good
+approach, but you have to know the entire chain of possible rewrapping that happens,
+when you might just care about one.
+
+@code{errwrap} formalizes this pattern (it doesn't matter what approach you use
+above) by giving a single interface for wrapping errors, checking if a specific error
+is wrapped, and extracting that error.")
+    (license license:mpl2.0)))
+
 (define-public go-github-com-jinzhu-copier
   (package
     (name "go-github-com-jinzhu-copier")

base-commit: 6f5ea7ac1acb3d1c53baf7620cca66cc87fe5a73
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: 0002-gnu-Add-go-github-com-hashicorp-go-multierror.patch --]
[-- Type: text/x-diff, Size: 2750 bytes --]

From 7887e3d855da22c33306bbd5729d396b607d78ad Mon Sep 17 00:00:00 2001
Message-ID: <7887e3d855da22c33306bbd5729d396b607d78ad.1709411277.git.poptsov.artyom@gmail.com>
In-Reply-To: <8ac21911360fa825fc0b13bd58ef64c5c9151ec7.1709411277.git.poptsov.artyom@gmail.com>
References: <8ac21911360fa825fc0b13bd58ef64c5c9151ec7.1709411277.git.poptsov.artyom@gmail.com>
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
Date: Sat, 2 Mar 2024 23:26:40 +0300
Subject: [PATCH 2/2] gnu: Add go-github-com-hashicorp-go-multierror.

* gnu/packages/golang-xyz.scm (go-github-com-hashicorp-go-multierror): New
  variable.

Change-Id: I6b09a52dc314c4cc6903690738debf4b6c99393f
---
 gnu/packages/golang-xyz.scm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/gnu/packages/golang-xyz.scm b/gnu/packages/golang-xyz.scm
index b52753c9bb..3dcfd690a3 100644
--- a/gnu/packages/golang-xyz.scm
+++ b/gnu/packages/golang-xyz.scm
@@ -724,6 +724,39 @@ (define-public go-github-com-hashicorp-errwrap
 is wrapped, and extracting that error.")
     (license license:mpl2.0)))
 
+(define-public go-github-com-hashicorp-go-multierror
+  (package
+    (name "go-github-com-hashicorp-go-multierror")
+    (version "1.1.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/hashicorp/go-multierror")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0l4s41skdpifndn9s8y6s9vzgghdzg4z8z0lld9qjr28888wzp00"))))
+    (build-system go-build-system)
+    (inputs (list go-github-com-hashicorp-errwrap))
+    (arguments
+     (list
+      #:import-path "github.com/hashicorp/go-multierror"))
+    (home-page "https://github.com/hashicorp/go-multierror")
+    (synopsis "Go package for representing a errors list as a single error")
+    (description
+     "@code{go-multierror} is a package for Go that provides a mechanism for
+representing a list of @code{error} values as a single @code{error}.
+
+This allows a function in Go to return an @code{error} that might actually be a list
+of errors.  If the caller knows this, they can unwrap the list and access the errors.
+If the caller doesn't know, the error formats to a nice human-readable format.
+
+@code{go-multierror} is fully compatible with the Go standard library @code{errors}
+package, including the functions @code{As}, @code{Is}, and @code{Unwrap}.  This
+provides a standardized approach for introspecting on error values.")
+    (license license:mpl2.0)))
+
 (define-public go-github-com-jinzhu-copier
   (package
     (name "go-github-com-jinzhu-copier")
-- 
2.41.0


[-- Attachment #1.4: Type: text/plain, Size: 480 bytes --]


Those packages are required for the newer Kubo (IPFS) versions. [3]

References:
1. https://github.com/hashicorp/errwrap
2. https://github.com/hashicorp/go-multierror
3. https://github.com/ipfs/kubo/blob/a01cc58c8dc4388eaf067e194ef1ee39191f86b5/go.mod#L17C2-L17C36

-- 
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
Home page: https://memory-heap.org/~avp/
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE  B57C E9C5 A2D9 0898 A02F

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 869 bytes --]

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#69512] [PATCH] gnu: Add go-github-com-hashicorp-go-multierror.
  2024-03-02 20:31 [bug#69512] [PATCH] gnu: Add go-github-com-hashicorp-go-multierror Artyom V. Poptsov
@ 2024-03-03 17:51 ` Sharlatan Hellseher
  2024-03-03 19:18   ` Artyom V. Poptsov
  2024-03-05 10:14 ` Sharlatan Hellseher
  2024-03-07  0:03 ` bug#69512: " Sharlatan Hellseher
  2 siblings, 1 reply; 6+ messages in thread
From: Sharlatan Hellseher @ 2024-03-03 17:51 UTC (permalink / raw)
  To: 69512; +Cc: Artyom V. Poptsov

[-- Attachment #1: Type: text/plain, Size: 226 bytes --]

Hi,

Thank you for the patches!

There is a conflict to apply these patches, may you check please?

I would suggest to place go-github-com-hashicorp-go-multierror
in golang-check, It seams to me more suitable module.

--
Oleg

[-- Attachment #2: Type: text/html, Size: 478 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#69512] [PATCH] gnu: Add go-github-com-hashicorp-go-multierror.
  2024-03-03 17:51 ` Sharlatan Hellseher
@ 2024-03-03 19:18   ` Artyom V. Poptsov
  0 siblings, 0 replies; 6+ messages in thread
From: Artyom V. Poptsov @ 2024-03-03 19:18 UTC (permalink / raw)
  To: Sharlatan Hellseher; +Cc: 69512

[-- Attachment #1: Type: text/plain, Size: 836 bytes --]

Hi!

> Thank you for the patches!

Thank you for the patch review.  ;-)

> There is a conflict to apply these patches, may you check please?

Okay, I re-based my patchset onto the "master" branch; no conflicts
were found in the process.

> I would suggest to place go-github-com-hashicorp-go-multierror
> in golang-check, It seams to me more suitable module.

I see that the "golang-check" module is for testing-related Go packages,
but it seems to me that "go-multierror" has wider range of use cases
than mere testing purposes (judging by its description at least.)

Could you elaborate?

Thanks!

- avp

-- 
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
Home page: https://memory-heap.org/~avp/
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE  B57C E9C5 A2D9 0898 A02F

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 869 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#69512] [PATCH] gnu: Add go-github-com-hashicorp-go-multierror.
  2024-03-02 20:31 [bug#69512] [PATCH] gnu: Add go-github-com-hashicorp-go-multierror Artyom V. Poptsov
  2024-03-03 17:51 ` Sharlatan Hellseher
@ 2024-03-05 10:14 ` Sharlatan Hellseher
  2024-03-05 19:47   ` Artyom V. Poptsov
  2024-03-07  0:03 ` bug#69512: " Sharlatan Hellseher
  2 siblings, 1 reply; 6+ messages in thread
From: Sharlatan Hellseher @ 2024-03-05 10:14 UTC (permalink / raw)
  To: Artyom V. Poptsov; +Cc: 69512

[-- Attachment #1: Type: text/plain, Size: 1062 bytes --]


Hi Aryom!

I've re-read description and made a review of the GitHub page of the
project, you are right about the purpose of this module so let's keep in
in golang-xyz.

I'm not sure if can access <https://qa.guix.gnu.org/issue/69512>. I
referred to this warning in QA:
--8<---------------cut here---------------start------------->8---
Unable to apply patches
Skipping: gnu: Add go-github-com-hashicorp-go-multierror.
Applying: gnu: Add go-github-com-hashicorp-go-multierror.
error: sha1 information is lacking or useless (gnu/packages/golang-xyz.scm).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0002 gnu: Add go-github-com-hashicorp-go-multierror.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
--8<---------------cut here---------------end--------------->8---
Perhaps it is no longer relevant, I'll check it locally.

Thanks,
Oleg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#69512] [PATCH] gnu: Add go-github-com-hashicorp-go-multierror.
  2024-03-05 10:14 ` Sharlatan Hellseher
@ 2024-03-05 19:47   ` Artyom V. Poptsov
  0 siblings, 0 replies; 6+ messages in thread
From: Artyom V. Poptsov @ 2024-03-05 19:47 UTC (permalink / raw)
  To: Sharlatan Hellseher; +Cc: 69512


[-- Attachment #1.1: Type: text/plain, Size: 84 bytes --]

Hello Oleg,

here are re-based patches -- maybe it'll help to solve build problems.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-Add-go-github-com-hashicorp-errwrap.patch --]
[-- Type: text/x-diff, Size: 2829 bytes --]

From d2a20e0d9659b3fbdfd6593c01067dafd61cf157 Mon Sep 17 00:00:00 2001
Message-ID: <d2a20e0d9659b3fbdfd6593c01067dafd61cf157.1709667844.git.poptsov.artyom@gmail.com>
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
Date: Sat, 2 Mar 2024 23:25:06 +0300
Subject: [PATCH 1/2] gnu: Add go-github-com-hashicorp-errwrap.

* gnu/packages/golang-xyz.scm (go-github-com-hashicorp-errwrap): New
  variable.

Change-Id: I4a0e7c23f9aaab4e29c81a68d976dafcd86dd2d1
---
 gnu/packages/golang-xyz.scm | 38 +++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/gnu/packages/golang-xyz.scm b/gnu/packages/golang-xyz.scm
index e68948e495..b52753c9bb 100644
--- a/gnu/packages/golang-xyz.scm
+++ b/gnu/packages/golang-xyz.scm
@@ -686,6 +686,44 @@ (define-public go-github-com-gabriel-vasile-mimetype
 @end itemize")
     (license license:expat)))
 
+(define-public go-github-com-hashicorp-errwrap
+  (package
+    (name "go-github-com-hashicorp-errwrap")
+    (version "1.1.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/hashicorp/errwrap")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0p5wdz8p7dmwphmb33gwhy3iwci5k9wkfqmmfa6ay1lz0cqjwp7a"))))
+    (build-system go-build-system)
+    (arguments
+     (list
+      #:import-path "github.com/hashicorp/errwrap"))
+    (home-page "https://github.com/hashicorp/errwrap")
+    (synopsis "Go library for wrapping and querying errors")
+    (description
+     "@code{errwrap} is a package for Go that formalizes the pattern of wrapping
+errors and checking if an error contains another error.
+
+There is a common pattern in Go of taking a returned @code{error} value and then
+wrapping it (such as with @code{fmt.Errorf}) before returning it.  The problem with
+this pattern is that you completely lose the original @code{error} structure.
+
+Arguably the correct approach is that you should make a custom structure implementing
+the @code{error} interface, and have the original error as a field on that structure,
+such as @url{http://golang.org/pkg/os/#PathError, this example}.  This is a good
+approach, but you have to know the entire chain of possible rewrapping that happens,
+when you might just care about one.
+
+@code{errwrap} formalizes this pattern (it doesn't matter what approach you use
+above) by giving a single interface for wrapping errors, checking if a specific error
+is wrapped, and extracting that error.")
+    (license license:mpl2.0)))
+
 (define-public go-github-com-jinzhu-copier
   (package
     (name "go-github-com-jinzhu-copier")

base-commit: b6dec0108f99d75066bad15aaa124b84bb0261f3
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: 0002-gnu-Add-go-github-com-hashicorp-go-multierror.patch --]
[-- Type: text/x-diff, Size: 2750 bytes --]

From f728a31c50c34a13efdfc4dec1a928efbbd35e39 Mon Sep 17 00:00:00 2001
Message-ID: <f728a31c50c34a13efdfc4dec1a928efbbd35e39.1709667844.git.poptsov.artyom@gmail.com>
In-Reply-To: <d2a20e0d9659b3fbdfd6593c01067dafd61cf157.1709667844.git.poptsov.artyom@gmail.com>
References: <d2a20e0d9659b3fbdfd6593c01067dafd61cf157.1709667844.git.poptsov.artyom@gmail.com>
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
Date: Sat, 2 Mar 2024 23:26:40 +0300
Subject: [PATCH 2/2] gnu: Add go-github-com-hashicorp-go-multierror.

* gnu/packages/golang-xyz.scm (go-github-com-hashicorp-go-multierror): New
  variable.

Change-Id: I6b09a52dc314c4cc6903690738debf4b6c99393f
---
 gnu/packages/golang-xyz.scm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/gnu/packages/golang-xyz.scm b/gnu/packages/golang-xyz.scm
index b52753c9bb..3dcfd690a3 100644
--- a/gnu/packages/golang-xyz.scm
+++ b/gnu/packages/golang-xyz.scm
@@ -724,6 +724,39 @@ (define-public go-github-com-hashicorp-errwrap
 is wrapped, and extracting that error.")
     (license license:mpl2.0)))
 
+(define-public go-github-com-hashicorp-go-multierror
+  (package
+    (name "go-github-com-hashicorp-go-multierror")
+    (version "1.1.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/hashicorp/go-multierror")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0l4s41skdpifndn9s8y6s9vzgghdzg4z8z0lld9qjr28888wzp00"))))
+    (build-system go-build-system)
+    (inputs (list go-github-com-hashicorp-errwrap))
+    (arguments
+     (list
+      #:import-path "github.com/hashicorp/go-multierror"))
+    (home-page "https://github.com/hashicorp/go-multierror")
+    (synopsis "Go package for representing a errors list as a single error")
+    (description
+     "@code{go-multierror} is a package for Go that provides a mechanism for
+representing a list of @code{error} values as a single @code{error}.
+
+This allows a function in Go to return an @code{error} that might actually be a list
+of errors.  If the caller knows this, they can unwrap the list and access the errors.
+If the caller doesn't know, the error formats to a nice human-readable format.
+
+@code{go-multierror} is fully compatible with the Go standard library @code{errors}
+package, including the functions @code{As}, @code{Is}, and @code{Unwrap}.  This
+provides a standardized approach for introspecting on error values.")
+    (license license:mpl2.0)))
+
 (define-public go-github-com-jinzhu-copier
   (package
     (name "go-github-com-jinzhu-copier")
-- 
2.41.0


[-- Attachment #1.4: Type: text/plain, Size: 216 bytes --]


- avp

-- 
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
Home page: https://memory-heap.org/~avp/
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE  B57C E9C5 A2D9 0898 A02F

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 869 bytes --]

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#69512: [PATCH] gnu: Add go-github-com-hashicorp-go-multierror.
  2024-03-02 20:31 [bug#69512] [PATCH] gnu: Add go-github-com-hashicorp-go-multierror Artyom V. Poptsov
  2024-03-03 17:51 ` Sharlatan Hellseher
  2024-03-05 10:14 ` Sharlatan Hellseher
@ 2024-03-07  0:03 ` Sharlatan Hellseher
  2 siblings, 0 replies; 6+ messages in thread
From: Sharlatan Hellseher @ 2024-03-07  0:03 UTC (permalink / raw)
  To: 69512-done

[-- Attachment #1: Type: text/plain, Size: 54 bytes --]


Pushed as d7abe61507..b577550c00 to master.

--
Oleg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-07  0:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-02 20:31 [bug#69512] [PATCH] gnu: Add go-github-com-hashicorp-go-multierror Artyom V. Poptsov
2024-03-03 17:51 ` Sharlatan Hellseher
2024-03-03 19:18   ` Artyom V. Poptsov
2024-03-05 10:14 ` Sharlatan Hellseher
2024-03-05 19:47   ` Artyom V. Poptsov
2024-03-07  0:03 ` bug#69512: " Sharlatan Hellseher

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.