about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-11-22T16·14+0000
committerVincent Ambo <tazjin@google.com>2019-11-22T16·14+0000
commit9ea0363e6f34a9f41b3c849359c97f06dbec2b9f (patch)
tree2b2c2f5715f8a2a00b3139ba0e4f314bf0260958
parent8710df08c8212d33a8b8d8bf22524fe290642842 (diff)
fix(buildGo): Use stable build ID when linking outputs
This is another step towards build reproducibility, which Go is
traditionally very bad at.
-rw-r--r--overrides/buildGo.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/overrides/buildGo.nix b/overrides/buildGo.nix
index 7ba9000e183b..72d8c232f6e3 100644
--- a/overrides/buildGo.nix
+++ b/overrides/buildGo.nix
@@ -50,9 +50,9 @@ let
   program = { name, srcs, deps ? [] }:
   let uniqueDeps = allDeps deps;
   in runCommand name {} ''
-    ${go}/bin/go tool compile -o ${name}.a -trimpath=$PWD ${includeSources uniqueDeps} ${spaceOut srcs}
+    ${go}/bin/go tool compile -o ${name}.a -trimpath=$PWD -trimpath=${go} ${includeSources uniqueDeps} ${spaceOut srcs}
     mkdir -p $out/bin
-    ${go}/bin/go tool link -o $out/bin/${name} ${includeLibs uniqueDeps} ${name}.a
+    ${go}/bin/go tool link -o $out/bin/${name} -buildid nix ${includeLibs uniqueDeps} ${name}.a
   '';
 
   # Build a Go library assembled out of the specified files.