From c3546c5f9c1733e8b7a7b9e6ed811b8aea5a45c9 Mon Sep 17 00:00:00 2001 From: edef Date: Mon, 3 Aug 2020 18:38:04 +0000 Subject: feat(nix/buildGo): expose gopkg attribute on buildGo.package This makes the derivations more uniform, since both third-party packages generated by buildGo.external and native buildGo.package expose their libraries as gopkg attributes now. Change-Id: I547f9860082f36e3300139bf67613eb4fc600d24 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1623 Tested-by: BuildkiteCI Reviewed-by: tazjin --- nix/buildGo/default.nix | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/nix/buildGo/default.nix b/nix/buildGo/default.nix index 03c0b2bc4b9d..5346b06ebd73 100644 --- a/nix/buildGo/default.nix +++ b/nix/buildGo/default.nix @@ -82,13 +82,19 @@ let asmPack = ifAsm '' ${go}/bin/go tool pack r $out/${path}.a ./asm.o ''; - in (runCommand "golib-${name}" {} '' - mkdir -p $out/${path} - ${srcList path (map (s: "${s}") srcs)} - ${asmBuild} - ${go}/bin/go tool compile -pack ${asmLink} -o $out/${path}.a -trimpath=$PWD -trimpath=${go} -p ${path} ${includeSources uniqueDeps} ${spaceOut srcs} - ${asmPack} - '') // { goDeps = uniqueDeps; goImportPath = path; }; + + gopkg = (runCommand "golib-${name}" {} '' + mkdir -p $out/${path} + ${srcList path (map (s: "${s}") srcs)} + ${asmBuild} + ${go}/bin/go tool compile -pack ${asmLink} -o $out/${path}.a -trimpath=$PWD -trimpath=${go} -p ${path} ${includeSources uniqueDeps} ${spaceOut srcs} + ${asmPack} + '') // { + inherit gopkg; + goDeps = uniqueDeps; + goImportPath = path; + }; + in gopkg; # Build a tree of Go libraries out of an external Go source # directory that follows the standard Go layout and was not built -- cgit 1.4.1