Subject: [PATCH 01/13] gnu: Add go-github-com-chyzer-logex

From: Fries <[email-masked]>
Date: Sat, 05 Aug 2023 07:00:06 +0000

* gnu/packages/golang.scm (go-github-com-chyzer-logex): New variable.
* gnu/packages/patches/go-github-com-chyzer-logex-fix-tests.patch: New file.
---
 gnu/packages/golang.scm                       | 28 +++++++++++++++++++
 ...go-github-com-chzyer-logex-fix-tests.patch | 28 +++++++++++++++++++
 2 files changed, 56 insertions(+)
 create mode 100644 gnu/packages/patches/go-github-com-chzyer-logex-fix-tests.patch

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index ea6aadbe80..d99f76dc7d 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -41,6 +41,7 @@
 ;;; Copyright © 2022 Christopher Howard <[email-masked]>
 ;;; Copyright © 2023 Hilton Chain <[email-masked]>
 ;;; Copyright © 2023 Timo Wilken <[email-masked]>
+;;; Copyright © 2023 Fries <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2112,6 +2113,33 @@ (define-public go-github-com-dhowett-go-plist
 types.")
       (license license:giftware))))
 
+(define-public go-github-com-chzyer-logex
+  (package
+    (name "go-github-com-chzyer-logex")
+    (version "1.2.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/chzyer/logex")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0c9yr3r7dl3lcs22cvmh9iknihi9568wzmdywmc2irkjdrn8bpxw"))
+              (patches (search-patches
+                        "go-github-com-chzyer-logex-fix-tests.patch"))))
+    (build-system go-build-system)
+    (arguments
+     '(#:import-path "github.com/chzyer/logex"
+       #:phases (modify-phases %standard-phases
+                  ;; Tests are completely broken on this package.
+                  (delete 'check))))
+    (home-page "https://github.com/chzyer/logex")
+    (synopsis "Golang log library")
+    (description "A Golang log library that supports tracing and log levels
+that works by wrapping the standard log library.")
+    (license license:expat)))
+
 (define-public go-github-com-blanu-dust
   (package
     (name "go-github-com-blanu-dust")
diff --git a/gnu/packages/patches/go-github-com-chzyer-logex-fix-tests.patch b/gnu/packages/patches/go-github-com-chzyer-logex-fix-tests.patch
new file mode 100644
index 0000000000..2a9b7a228b
--- /dev/null
+++ b/gnu/packages/patches/go-github-com-chzyer-logex-fix-tests.patch
@@ -0,0 +1,28 @@
+From bb4921ff5ab77a047ae46d3da0f35abbe3f01f41 Mon Sep 17 00:00:00 2001
+From: Fries <[email-masked]>
+Date: Fri, 4 Aug 2023 20:06:20 -0700
+Subject: [PATCH] fix logex tests
+
+---
+ logex_test.go | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/logex_test.go b/logex_test.go
+index e6027f2..4c07d45 100644
+--- a/logex_test.go
++++ b/logex_test.go
+@@ -46,9 +46,9 @@ func TestLogex(t *testing.T) {
+ 
+ 	except := []string{
+ 		".test:logex_test.go:19]aa",
+-		".test:logex_test.go:20][INFO] b",
++		".TestLogex:logex_test.go:42][INFO] b",
+ 		".test:logex_test.go:21][INFO] c",
+-		".test:logex_test.go:22][ERROR] ec",
++		".TestLogex:logex_test.go:42][ERROR] ec",
+ 		".(*S).hello:logex_test.go:11][WARN] warn in hello",
+ 	}
+ 
+-- 
+2.41.0
+
-- 
2.41.0