unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Attila Lendvai <attila@lendvai.name>
To: 54906@debbugs.gnu.org
Cc: Attila Lendvai <attila@lendvai.name>
Subject: [bug#54906] [PATCH] build: go-build-system: Add support for #:skip-build? #t.
Date: Wed, 13 Apr 2022 14:00:42 +0200	[thread overview]
Message-ID: <20220413120052.25602-1-attila@lendvai.name> (raw)

This mimics the same feature of the cargo-build-system.

* guix/build-system/go.scm (go-build): Add skip-build? keyword param and
propagate it.
* guix/build/go-build-system.scm (build): Add skip-build? keyword param.
---
 guix/build-system/go.scm       |  4 +++-
 guix/build/go-build-system.scm | 31 ++++++++++++++++---------------
 2 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm
index 5e0e5bbad3..6bcb3656be 100644
--- a/guix/build-system/go.scm
+++ b/guix/build-system/go.scm
@@ -175,6 +175,7 @@ (define* (go-build name inputs
                    (import-path "")
                    (unpack-path "")
                    (build-flags ''())
+                   (skip-build? #f)
                    (tests? #t)
                    (allow-go-reference? #f)
                    (system (%current-system))
@@ -205,7 +206,8 @@ (define builder
                     #:import-path #$import-path
                     #:unpack-path #$unpack-path
                     #:build-flags #$build-flags
-                    #:tests? #$tests?
+                    #:skip-build? #$skip-build?
+                    #:tests? #$(and tests? (not skip-build?))
                     #:allow-go-reference? #$allow-go-reference?
                     #:inputs #$(input-tuples->gexp inputs)))))
 
diff --git a/guix/build/go-build-system.scm b/guix/build/go-build-system.scm
index 7f25e05d0d..637d66a6f1 100644
--- a/guix/build/go-build-system.scm
+++ b/guix/build/go-build-system.scm
@@ -254,22 +254,23 @@ (define (go-inputs inputs)
                 (_ #f))
               inputs))))
 
-(define* (build #:key import-path build-flags #:allow-other-keys)
+(define* (build #:key skip-build? import-path build-flags #:allow-other-keys)
   "Build the package named by IMPORT-PATH."
-  (with-throw-handler
-    #t
-    (lambda _
-      (apply invoke "go" "install"
-              "-v" ; print the name of packages as they are compiled
-              "-x" ; print each command as it is invoked
-              ;; Respectively, strip the symbol table and debug
-              ;; information, and the DWARF symbol table.
-              "-ldflags=-s -w"
-              `(,@build-flags ,import-path)))
-    (lambda (key . args)
-      (display (string-append "Building '" import-path "' failed.\n"
-                              "Here are the results of `go env`:\n"))
-      (invoke "go" "env"))))
+  (or skip-build?
+      (with-throw-handler
+        #t
+        (lambda _
+          (apply invoke "go" "install"
+                 "-v"        ; print the name of packages as they are compiled
+                 "-x"        ; print each command as it is invoked
+                 ;; Respectively, strip the symbol table and debug
+                 ;; information, and the DWARF symbol table.
+                 "-ldflags=-s -w"
+                 `(,@build-flags ,import-path)))
+        (lambda (key . args)
+          (display (string-append "Building '" import-path "' failed.\n"
+                                  "Here are the results of `go env`:\n"))
+          (invoke "go" "env")))))
 
 ;; Can this also install commands???
 (define* (check #:key tests? import-path #:allow-other-keys)
-- 
2.35.1





             reply	other threads:[~2022-04-13 12:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-13 12:00 Attila Lendvai [this message]
2022-04-14 10:38 ` [bug#54906] [PATCH] build: go-build-system: Add support for #:skip-build? #t Ricardo Wurmus
2022-04-27 16:33 ` [bug#54906] ping Attila Lendvai
2022-04-27 17:42 ` [bug#54906] [PATCH] build: go-build-system: Add support for #:skip-build? #t Katherine Cox-Buday
2022-04-27 19:22 ` Maxime Devos
2022-04-28 10:56   ` Attila Lendvai
2022-04-28 11:35     ` Maxime Devos
2022-04-28 12:14       ` Attila Lendvai
2022-06-13  1:53         ` Maxime Devos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220413120052.25602-1-attila@lendvai.name \
    --to=attila@lendvai.name \
    --cc=54906@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).