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 <mail@tazj.in>
This commit is contained in:
edef 2020-08-03 18:38:04 +00:00
parent cf35ad4fa9
commit c3546c5f9c

View file

@ -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