From 4798af971ce9a61841d59dbf5f7b011c79b4c3ec Mon Sep 17 00:00:00 2001 From: Sharlatan Hellseher Date: Fri, 12 Jul 2024 13:31:58 +0100 Subject: [PATCH] gnu: go-golang-org-x-mod: Enable tests. * gnu/packages/golang-build.scm (go-golang-org-x-mod): Apply new package style. [source]: Swap URI to as for other go-golang-org-x-* packages. [arguments]: <#:phases>: Add 'remove-test-files phase. Use custom 'check phase. Change-Id: I806d0beab89047be5fbb181db4b410c1f8df0764 --- gnu/packages/golang-build.scm | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/gnu/packages/golang-build.scm b/gnu/packages/golang-build.scm index d55fe2ac19..8b2d93d72a 100644 --- a/gnu/packages/golang-build.scm +++ b/gnu/packages/golang-build.scm @@ -248,18 +248,36 @@ compile does not support generics.") (origin (method git-fetch) (uri (git-reference - (url "https://github.com/golang/mod") + (url "https://go.googlesource.com/mod") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "02wilb8q2bp6qhqcrbjxq1pjy3y5k8p11pxlg481609zx4rjiszc")))) (build-system go-build-system) (arguments - '(#:import-path "golang.org/x/mod/" - #:tests? #f - #:phases (modify-phases %standard-phases - ;; Source-only package - (delete 'build)))) + (list + #:import-path "golang.org/x/mod" + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'remove-test-files + (lambda* (#:key import-path #:allow-other-keys) + (with-directory-excursion (string-append "src/" import-path) + (for-each delete-file + (list + ;; Break cycle: go-golang-org-x-mod -> + ;; go-golang-org-x-tools -> go-golang-org-x-mod. + "zip/zip_test.go" + ;; Trying to access + ;; . + "sumdb/tlog/ct_test.go"))))) + ;; 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" "./...")))))))) (home-page "https://golang.org/x/mod") (synopsis "Tools to work directly with Go module mechanics") (description