summaryrefslogtreecommitdiff
path: root/gnu/packages/golang.scm
diff options
context:
space:
mode:
authorSarah Morgensen <iskarian@mgsn.dev>2021-09-19 22:20:50 -0700
committerLeo Famulari <leo@famulari.name>2021-12-24 16:32:25 -0500
commitd6121d7dd6998118de2c9327291cc942fff54e31 (patch)
tree72e6682b4e38a3b36f352080b3d188fd67166a6c /gnu/packages/golang.scm
parentc90f73f8164a209884471f1c41948d0556e6c39e (diff)
downloadguix-patches-d6121d7dd6998118de2c9327291cc942fff54e31.tar
guix-patches-d6121d7dd6998118de2c9327291cc942fff54e31.tar.gz
build-system/go: Add pre-built standard library as implicit input.
* gnu/packages/golang.scm (make-go-std): New procedure. * guix/build-system/go.scm (make-go-std): New procedure. (lower): Use it. Add pre-built standard library to inputs. Signed-off-by: Leo Famulari <leo@famulari.name>
Diffstat (limited to 'gnu/packages/golang.scm')
-rw-r--r--gnu/packages/golang.scm30
1 files changed, 30 insertions, 0 deletions
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 87e4d5d3d0..d7770724d2 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -831,6 +831,36 @@ in the style of communicating sequential processes (@dfn{CSP}).")
(define-public go go-1.14)
+(define-public (make-go-std go)
+ "Return a package which builds the standard library for Go compiler GO."
+ (package
+ (name (string-append (package-name go) "-std"))
+ (version (package-version go))
+ (source #f)
+ (build-system go-build-system)
+ (arguments
+ `(#:import-path "std"
+ #:build-flags `("-pkgdir" "pkg") ; "Install" to build directory.
+ #:allow-go-reference? #t
+ #:substitutable? #f ; Faster to build than download.
+ #:tests? #f ; Already tested in the main Go build.
+ #:go ,go
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'unpack)
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (out-cache (string-append out "/var/cache/go/build")))
+ (copy-recursively (getenv "GOCACHE") out-cache)
+ (delete-file (string-append out-cache "/trim.txt"))
+ (delete-file (string-append out-cache "/README")))))
+ (delete 'install-license-files))))
+ (home-page (package-home-page go))
+ (synopsis "Cached standard library build for Go")
+ (description (package-description go))
+ (license (package-license go))))
+
(define-public go-0xacab-org-leap-shapeshifter
(let ((commit "0aa6226582efb8e563540ec1d3c5cfcd19200474")
(revision "12"))