guix_mirror_bot pushed a commit to branch master
in repository guix.

commit 847b3dacd3a8ea2fd7da0f4ece5c7e1d82716aa5
Author: Maxim Cournoyer <[email protected]>
AuthorDate: Wed May 28 09:43:42 2025 +0900

    gnu: Add go-github-com-jiu2015-gotestspace.
    
    * gnu/packages/golang-check.scm (go-github-com-jiu2015-gotestspace): New 
variable.
    
    Change-Id: I4a7c627f14eb5d392c66a04e8e2c2aef7ca8921f
    Modified-by: Sharlatan Hellseher <[email protected]>
    Signed-off-by: Sharlatan Hellseher <[email protected]>
---
 gnu/packages/golang-check.scm | 71 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 70 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/golang-check.scm b/gnu/packages/golang-check.scm
index 51af496b64..9c355d5e4e 100644
--- a/gnu/packages/golang-check.scm
+++ b/gnu/packages/golang-check.scm
@@ -25,6 +25,7 @@
 ;;; Copyright © 2024 Sharlatan Hellseher <[email protected]>
 ;;; Copyright © 2024 Troy Figiel <[email protected]>
 ;;; Copyright © 2024 Roman Scherer <[email protected]>
+;;; Copyright © 2025 Maxim Cournoyer <[email protected]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -49,8 +50,10 @@
   #:use-module (guix git-download)
   #:use-module (guix utils)
   #:use-module (gnu packages)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages golang-build)
-  #:use-module (gnu packages golang-xyz))
+  #:use-module (gnu packages golang-xyz)
+  #:use-module (gnu packages version-control))
 
 ;;; Commentary:
 ;;;
@@ -1258,6 +1261,72 @@ Many times certain facilities are not available, or 
tests must run
 differently.")
     (license license:expat)))
 
+(define-public go-github-com-jiu2015-gotestspace
+  (package
+    (name "go-github-com-jiu2015-gotestspace")
+    (version "1.1.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/Jiu2015/gotestspace";)
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1wcvdp1wjqj3lh2vdhb2vph528vncjs3vixjriwkxrn979b59y4s"))))
+    (build-system go-build-system)
+    (arguments
+     (list
+      #:import-path "github.com/Jiu2015/gotestspace"
+      ;; Our patching causes some discrepancies in the expected
+      ;; output/values.
+      ;;
+      ;; expected: "goshelltest2=222"
+      ;; actual  : "goshelltest1=111"
+      #:test-flags
+      #~(list "-skip" (string-join
+                       (list "TestNewShellSpace/path_and_env_parameter"
+                             "TestNewShellSpace/path_and_env_and_tem.*r$")
+                       "|"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'remove-example
+            (lambda* (#:key import-path #:allow-other-keys)
+              (with-directory-excursion (string-append "src/" import-path)
+                (delete-file-recursively "example"))))
+          (add-after 'unpack 'preserve-PATH-from-environment
+            ;; Unlike FHS systems, Guix needs to look its commands fom PATH.
+            ;; Expose it by default in the test environments.
+            (lambda* (#:key tests? import-path #:allow-other-keys)
+              (with-directory-excursion (string-append "src/" import-path)
+                (substitute* "options.go"
+                  (("\"GIT_COMMITTER_NAME='C O Mitter'\"," all)
+                   (string-append
+                    all "\n\t\t\t\"PATH=\" + os.Getenv(\"PATH\"),"))))))
+          (add-after 'unpack 'patch-commands
+            (lambda* (#:key import-path inputs #:allow-other-keys)
+              (with-directory-excursion (string-append "src/" import-path)
+                ;; Runtime modules.
+                (substitute* "testspace.go"
+                  (("/bin/bash")
+                   (search-input-file inputs "bin/bash"))
+                  (("\"git\"")
+                   (format #f "~s" (search-input-file inputs 
"bin/git"))))))))))
+    (native-inputs
+     (list git-minimal
+           go-github-com-stretchr-testify))
+    (inputs
+     (list bash-minimal
+           git-minimal))
+    (home-page "https://github.com/Jiu2015/gotestspace";)
+    (synopsis "Create Go workspaces that can quickly run shell commands")
+    (description
+     "@code{gotestspace} is used to quickly create a working directory for
+shell execution using Go, as well as a tool for customizing the execution of
+the shell.  It can help you quickly create an independent workspace for unit
+testing and improve the efficiency of unit test writing.")
+    (license license:gpl3+)))
+
 (define-public go-github-com-jmhodges-clock
   (package
     (name "go-github-com-jmhodges-clock")

Reply via email to