From 596e1f7f77e399d1ba32cd00747aa3f94f718a0d Mon Sep 17 00:00:00 2001 From: edef Date: Mon, 3 Aug 2020 18:42:42 +0000 Subject: 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 --- nix/buildGo/default.nix | 4 ++-- nix/buildGo/external/default.nix | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'nix/buildGo') diff --git a/nix/buildGo/default.nix b/nix/buildGo/default.nix index 5346b06ebd..9999d1423e 100644 --- a/nix/buildGo/default.nix +++ b/nix/buildGo/default.nix @@ -53,7 +53,7 @@ let # Build a Go program out of the specified files and dependencies. program = { name, srcs, deps ? [], x_defs ? {} }: - let uniqueDeps = allDeps deps; + let uniqueDeps = allDeps (map (d: d.gopkg) deps); in runCommand name {} '' ${go}/bin/go tool compile -o ${name}.a -trimpath=$PWD -trimpath=${go} ${includeSources uniqueDeps} ${spaceOut srcs} mkdir -p $out/bin @@ -67,7 +67,7 @@ let # needed when downstream packages depend on it. package = { name, srcs, deps ? [], path ? name, sfiles ? [] }: let - uniqueDeps = allDeps deps; + uniqueDeps = allDeps (map (d: d.gopkg) deps); # The build steps below need to be executed conditionally for Go # assembly if the analyser detected any *.s files. diff --git a/nix/buildGo/external/default.nix b/nix/buildGo/external/default.nix index 48f678688e..6f31fbe5ca 100644 --- a/nix/buildGo/external/default.nix +++ b/nix/buildGo/external/default.nix @@ -83,7 +83,7 @@ in { src, path, deps ? [] }: let depMap = listToAttrs (map (d: { name = d.goImportPath; value = d; - }) deps); + }) (map (d: d.gopkg) deps)); name = pathToName path; analysisOutput = runCommand "${name}-structure.json" {} '' -- cgit 1.4.1