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 '' asmPack = ifAsm ''
${go}/bin/go tool pack r $out/${path}.a ./asm.o ${go}/bin/go tool pack r $out/${path}.a ./asm.o
''; '';
in (runCommand "golib-${name}" {} ''
gopkg = (runCommand "golib-${name}" {} ''
mkdir -p $out/${path} mkdir -p $out/${path}
${srcList path (map (s: "${s}") srcs)} ${srcList path (map (s: "${s}") srcs)}
${asmBuild} ${asmBuild}
${go}/bin/go tool compile -pack ${asmLink} -o $out/${path}.a -trimpath=$PWD -trimpath=${go} -p ${path} ${includeSources uniqueDeps} ${spaceOut srcs} ${go}/bin/go tool compile -pack ${asmLink} -o $out/${path}.a -trimpath=$PWD -trimpath=${go} -p ${path} ${includeSources uniqueDeps} ${spaceOut srcs}
${asmPack} ${asmPack}
'') // { goDeps = uniqueDeps; goImportPath = path; }; '') // {
inherit gopkg;
goDeps = uniqueDeps;
goImportPath = path;
};
in gopkg;
# Build a tree of Go libraries out of an external Go source # Build a tree of Go libraries out of an external Go source
# directory that follows the standard Go layout and was not built # directory that follows the standard Go layout and was not built