fix(nix/buildGo): Remove absolute references to GOROOT from binaries
Setting the GOROOT_FINAL environment variables replaces the absolute location of the Go standard library sources in the final build artefacts with a fake location (in this case starting with go/src/...). This is despite the documentation for 'trimpath' (in 'go tool compile') stating that it would affect all source paths: That's only true for user code! I figured this out by reading through the implementation of the other 'trimpath' (in 'gob build'): https://go-review.googlesource.com/c/go/+/173345
This commit is contained in:
parent
eab4f0e9c0
commit
db74ffb4b1
1 changed files with 1 additions and 0 deletions
|
@ -57,6 +57,7 @@ let
|
||||||
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
|
||||||
|
export GOROOT_FINAL=go
|
||||||
${go}/bin/go tool link -o $out/bin/${name} -buildid nix ${xFlags x_defs} ${includeLibs uniqueDeps} ${name}.a
|
${go}/bin/go tool link -o $out/bin/${name} -buildid nix ${xFlags x_defs} ${includeLibs uniqueDeps} ${name}.a
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue