feat(nix/buildGo): use gopkg attribute of deps

This removes the need for `map (x: x.gopkg)` in dependency lists.

Change-Id: Ia19e51f14110bf22f5cdbb64fa7ce182e1b34241
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1624
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
edef 2020-08-03 18:42:42 +00:00
parent c3546c5f9c
commit 596e1f7f77
2 changed files with 3 additions and 3 deletions

View file

@ -53,7 +53,7 @@ let
# Build a Go program out of the specified files and dependencies. # Build a Go program out of the specified files and dependencies.
program = { name, srcs, deps ? [], x_defs ? {} }: program = { name, srcs, deps ? [], x_defs ? {} }:
let uniqueDeps = allDeps deps; let uniqueDeps = allDeps (map (d: d.gopkg) deps);
in runCommand name {} '' in runCommand name {} ''
${go}/bin/go tool compile -o ${name}.a -trimpath=$PWD -trimpath=${go} ${includeSources uniqueDeps} ${spaceOut srcs} ${go}/bin/go tool compile -o ${name}.a -trimpath=$PWD -trimpath=${go} ${includeSources uniqueDeps} ${spaceOut srcs}
mkdir -p $out/bin mkdir -p $out/bin
@ -67,7 +67,7 @@ let
# needed when downstream packages depend on it. # needed when downstream packages depend on it.
package = { name, srcs, deps ? [], path ? name, sfiles ? [] }: package = { name, srcs, deps ? [], path ? name, sfiles ? [] }:
let let
uniqueDeps = allDeps deps; uniqueDeps = allDeps (map (d: d.gopkg) deps);
# The build steps below need to be executed conditionally for Go # The build steps below need to be executed conditionally for Go
# assembly if the analyser detected any *.s files. # assembly if the analyser detected any *.s files.

View file

@ -83,7 +83,7 @@ in { src, path, deps ? [] }: let
depMap = listToAttrs (map (d: { depMap = listToAttrs (map (d: {
name = d.goImportPath; name = d.goImportPath;
value = d; value = d;
}) deps); }) (map (d: d.gopkg) deps));
name = pathToName path; name = pathToName path;
analysisOutput = runCommand "${name}-structure.json" {} '' analysisOutput = runCommand "${name}-structure.json" {} ''