aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarah Morgensen <iskarian@mgsn.dev>2021-08-06 21:48:33 -0700
committerLudovic Courtès <ludo@gnu.org>2024-08-31 10:44:36 +0200
commit92046a65fa7820a60c2773650072a488ac23dc83 (patch)
treef50daba6e95b30b7629e6f5c07f64d8ce21f482c
parentd86b0d9689a0b6e6715360cd0916f8cb61dafe56 (diff)
downloadguix-92046a65fa7820a60c2773650072a488ac23dc83.tar.gz
guix-92046a65fa7820a60c2773650072a488ac23dc83.zip
build-system/go: Honor #:parallel-build?.
guix/build/go-build-system.scm (build): Honor #:parallel-build?. guix/build-system/go.scm (go-build): Add PARALLEL-BUILD? parameter. [builder]: Use it. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
-rw-r--r--guix/build-system/go.scm2
-rw-r--r--guix/build/go-build-system.scm6
2 files changed, 7 insertions, 1 deletions
diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm
index 9a182d2505..1e8ecba80c 100644
--- a/guix/build-system/go.scm
+++ b/guix/build-system/go.scm
@@ -192,6 +192,7 @@ commit hash and its date rather than a proper release tag."
(unpack-path "")
(build-flags ''())
(tests? #t)
+ (parallel-build? #t)
(allow-go-reference? #f)
(system (%current-system))
(goarch #f)
@@ -222,6 +223,7 @@ commit hash and its date rather than a proper release tag."
#:unpack-path #$unpack-path
#:build-flags #$build-flags
#:tests? #$tests?
+ #:parallel-build? #$parallel-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 d95262bd6c..160323b65e 100644
--- a/guix/build/go-build-system.scm
+++ b/guix/build/go-build-system.scm
@@ -256,8 +256,12 @@ unpacking."
(_ #f))
inputs))))
-(define* (build #:key import-path build-flags #:allow-other-keys)
+(define* (build #:key import-path build-flags (parallel-build? #t)
+ #:allow-other-keys)
"Build the package named by IMPORT-PATH."
+ (let* ((njobs (if parallel-build? (parallel-job-count) 1)))
+ (setenv "GOMAXPROCS" (number->string njobs)))
+
(with-throw-handler
#t
(lambda _