Subject: [bug#61946] [PATCH 2/6] gnu: Add go-github-com-matryer-try.

From: Thomas Ieong <[email-masked]>
Date: Sat, 4 Mar 2023 00:01:55 +0100

* gnu/packages/golang.scm (go-github-com-matryer-try): New variable.
---
 gnu/packages/golang.scm | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index e213ce6cb6..1bd2a51d8d 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -9637,6 +9637,37 @@ (define-public go-github-com-djherbis-atime
      "Package atime provides a platform-independent way to get atimes for files.")
     (license license:expat)))
 
+(define-public go-github-com-matryer-try
+  (package
+    (name "go-github-com-matryer-try")
+    (version "1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/matryer/try")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "15f0m5ywihivnvwzcw0mh0sg27aky9rkywvxqszxka9q051qvsmy"))))
+    (build-system go-build-system)
+    (native-inputs (list go-github-com-cheekybits-is))
+    (arguments
+     (list #:import-path "github.com/matryer/try"
+           #:phases #~(modify-phases %standard-phases
+                        (add-after 'unpack 'fix-tests
+                          (lambda* (#:key import-path #:allow-other-keys)
+                            (substitute* (string-append "src/" import-path
+                                                        "/try_test.go")
+                              (("var value string")
+                               "")
+                              (("value, err = SomeFunction\\(\\)")
+                               "_, err = SomeFunction()")))))))
+    (home-page "https://github.com/matryer/try")
+    (synopsis "Simple idiomatic retry package for Go")
+    (description "Package try provides retry functionality.")
+    (license license:expat)))
+
 (define-public go-github-com-hashicorp-go-syslog
   (package
     (name "go-github-com-hashicorp-go-syslog")
-- 
2.39.1