sharlatan pushed a commit to branch go-team
in repository guix.

commit 10b868c0a7d5fdb9edc68b0d56b64723e664af14
Author: Sharlatan Hellseher <sharlata...@gmail.com>
AuthorDate: Thu Jul 25 07:41:56 2024 +0100

    gnu: go-github-com-prometheus-client-golang: Enable tests.
    
    * gnu/packages/golang.scm (go-github-com-prometheus-client-golang):
    Enable tests.
    [arguments]: <#:phases>: Add 'remove-examples-and-tutorials and use
    custom 'check phase.
    
    Change-Id: I70de72754188b558b730b92d7561d88690b02f7c
---
 gnu/packages/golang.scm | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 34585a68c5..56e6c6a627 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -7390,12 +7390,24 @@ system, kernel, and process metrics from the 
@file{/proc} pseudo file system.")
                 "0mx5q221pbkx081ycf1lp8sxz513220ya8qczkkvab943cwlcarv"))))
     (build-system go-build-system)
     (arguments
-     '(#:tests? #f
-       #:import-path "github.com/prometheus/client_golang"
-       #:phases
-       (modify-phases %standard-phases
-         ;; Source-only package
-         (delete 'build))))
+     (list
+      #:import-path "github.com/prometheus/client_golang"
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'remove-examples-and-tutorials
+            (lambda* (#:key import-path #:allow-other-keys)
+              (with-directory-excursion (string-append "src/" import-path)
+                (for-each delete-file-recursively
+                          (list "api/prometheus/v1/example_test.go"
+                                "examples"
+                                "tutorial")))))
+          ;; XXX: Workaround for go-build-system's lack of Go modules support.
+          (delete 'build)
+          (replace 'check
+            (lambda* (#:key tests? import-path #:allow-other-keys)
+              (when tests?
+                (with-directory-excursion (string-append "src/" import-path)
+                  (invoke "go" "test" "-v" "./..."))))))))
     (propagated-inputs
      (list go-github-com-beorn7-perks
            go-github-com-cespare-xxhash-v2

Reply via email to