fix(nix/buildGo): fix for Nix >= 2.6 readFile changes
The string context retained by readFile would leak into attribute keys in fromJSON which may not have string context in any Nix version. We don't need Nix >= 2.6 support, but buildGo may have external users and this change is simple enough. Change-Id: I593f1ef513502691119428d26d508a5f4d378543 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6946 Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
This commit is contained in:
parent
fcd5e53703
commit
81fadbe6eb
1 changed files with 4 additions and 1 deletions
5
nix/buildGo/external/default.nix
vendored
5
nix/buildGo/external/default.nix
vendored
|
@ -13,6 +13,7 @@ let
|
|||
readFile
|
||||
replaceStrings
|
||||
tail
|
||||
unsafeDiscardStringContext
|
||||
throw;
|
||||
|
||||
inherit (pkgs) lib runCommand go jq ripgrep;
|
||||
|
@ -102,7 +103,9 @@ let
|
|||
analysisOutput = runCommand "${name}-structure.json" { } ''
|
||||
${analyser}/bin/analyser -path ${path} -source ${src} > $out
|
||||
'';
|
||||
analysis = fromJSON (readFile analysisOutput);
|
||||
# readFile adds the references of the read in file to the string context for
|
||||
# Nix >= 2.6 which would break the attribute set construction in fromJSON
|
||||
analysis = fromJSON (unsafeDiscardStringContext (readFile analysisOutput));
|
||||
in
|
||||
lib.fix (self: foldl' lib.recursiveUpdate { } (
|
||||
map (entry: mkset entry.locator (toPackage self src path depMap entry)) analysis
|
||||
|
|
Loading…
Reference in a new issue