diff options
author | sterni <sternenseemann@systemli.org> | 2022-10-11T12·32+0200 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2022-10-11T17·38+0000 |
commit | 81fadbe6eb037cbbe08e35ea692fd1dbe993f354 (patch) | |
tree | 6ece6d1d391d9f1d5abb28582acb2dd5a416f08f /nix | |
parent | fcd5e5370320d934f371bb96069a4719e94aafcd (diff) |
fix(nix/buildGo): fix for Nix >= 2.6 readFile changes r/5106
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
Diffstat (limited to 'nix')
-rw-r--r-- | nix/buildGo/external/default.nix | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/nix/buildGo/external/default.nix b/nix/buildGo/external/default.nix index f713783a58be..42592c67e482 100644 --- a/nix/buildGo/external/default.nix +++ b/nix/buildGo/external/default.nix @@ -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 |