about summary refs log tree commit diff
path: root/nix/buildGo
diff options
context:
space:
mode:
authoredef <edef@edef.eu>2020-08-03T18·42+0000
committeredef <edef@edef.eu>2020-08-04T07·42+0000
commit596e1f7f77e399d1ba32cd00747aa3f94f718a0d (patch)
tree5706f71c4cd40c698805c207f179cc8118b3a178 /nix/buildGo
parentc3546c5f9c1733e8b7a7b9e6ed811b8aea5a45c9 (diff)
feat(nix/buildGo): use gopkg attribute of deps r/1579
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>
Diffstat (limited to 'nix/buildGo')
-rw-r--r--nix/buildGo/default.nix4
-rw-r--r--nix/buildGo/external/default.nix2
2 files changed, 3 insertions, 3 deletions
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" {} ''