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>
This commit is contained in:
Sarah Morgensen 2021-08-06 21:48:33 -07:00 committed by Ludovic Courtès
parent d86b0d9689
commit 92046a65fa
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 7 additions and 1 deletions

View file

@ -192,6 +192,7 @@ (define* (go-build name inputs
(unpack-path "")
(build-flags ''())
(tests? #t)
(parallel-build? #t)
(allow-go-reference? #f)
(system (%current-system))
(goarch #f)
@ -222,6 +223,7 @@ (define builder
#: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)))))

View file

@ -256,8 +256,12 @@ (define (go-inputs inputs)
(_ #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 _