diff options
author | Matthew Bauer <mjbauer95@gmail.com> | 2019-06-22 22:07:26 -0400 |
---|---|---|
committer | Wael Nasreddine <wael.nasreddine@gmail.com> | 2019-06-22 19:07:26 -0700 |
commit | 1f46aaab1b679b4db0b78b3ee16c0978f0bf66aa (patch) | |
tree | 8720edfedf69fd6649ba938fd46ad5b9908d6218 /pkgs/development/go-packages | |
parent | 2b5ba7f723a4a50cd452438c333e6ac4bc6e15b3 (diff) | |
download | nixpkgs-1f46aaab1b679b4db0b78b3ee16c0978f0bf66aa.tar nixpkgs-1f46aaab1b679b4db0b78b3ee16c0978f0bf66aa.tar.gz nixpkgs-1f46aaab1b679b4db0b78b3ee16c0978f0bf66aa.tar.bz2 nixpkgs-1f46aaab1b679b4db0b78b3ee16c0978f0bf66aa.tar.lz nixpkgs-1f46aaab1b679b4db0b78b3ee16c0978f0bf66aa.tar.xz nixpkgs-1f46aaab1b679b4db0b78b3ee16c0978f0bf66aa.tar.zst nixpkgs-1f46aaab1b679b4db0b78b3ee16c0978f0bf66aa.zip |
buildGoPackage: keep string context (#63680)
In Nix, each string has a context that it carries of where it originated. Some functions like filterAttrs modify the context of its args when doing comparisons. That is important because we use the string context of “name” to get where a derivation was defined. This causes some builtins like unsafeGetAttrPos to report incorrectly that the string was set in lib/attrsets.nix and reporting that as the source file. Using removeAttrs avoids this problem. Fixes #63679
Diffstat (limited to 'pkgs/development/go-packages')
-rw-r--r-- | pkgs/development/go-packages/generic/default.nix | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/pkgs/development/go-packages/generic/default.nix b/pkgs/development/go-packages/generic/default.nix index eb45f446dc9..8e016fadfac 100644 --- a/pkgs/development/go-packages/generic/default.nix +++ b/pkgs/development/go-packages/generic/default.nix @@ -35,14 +35,12 @@ # IE: programs coupled with the compiler , allowGoReference ? false -, meta ? {}, ... } @ args': +, meta ? {}, ... } @ args: with builtins; let - args = lib.filterAttrs (name: _: name != "extraSrcs") args'; - removeReferences = [ ] ++ lib.optional (!allowGoReference) go; removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}''; @@ -75,7 +73,7 @@ let goPath = if goDeps != null then importGodeps { depsFile = goDeps; } ++ extraSrcs else extraSrcs; package = go.stdenv.mkDerivation ( - (builtins.removeAttrs args [ "goPackageAliases" "disabled" ]) // { + (builtins.removeAttrs args [ "goPackageAliases" "disabled" "extraSrcs"]) // { nativeBuildInputs = [ removeReferencesTo go ] ++ (lib.optional (!dontRenameImports) govers) ++ nativeBuildInputs; |