git.iko.soy/typeable/nixpkgs
on master help sign in
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

commit1f46aaab1b679b4db0b78b3ee16c0978f0bf66aa authorMatthew Bauer <mjbauer95@gmail.com> dateSat 22 Jun 2019, 22:07 (7 years ago) parent2b5ba7f
1 file changed+2−4
pkgs/development/go-packages/generic/default.nix+2−4
pkgs/development/go-packages/generic/default.nix+2−4
@@ -35,14 +35,12 @@
3535# IE: programs coupled with the compiler
3636, allowGoReference ? false
3737
38−, meta ? {}, ... } @ args':
38+, meta ? {}, ... } @ args:
3939
4040
4141with builtins;
4242
4343let
44− args = lib.filterAttrs (name: _: name != "extraSrcs") args';
45−
4644 removeReferences = [ ] ++ lib.optional (!allowGoReference) go;
4745
4846 removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}'';
@@ -75,7 +73,7 @@ let
7573 goPath = if goDeps != null then importGodeps { depsFile = goDeps; } ++ extraSrcs
7674 else extraSrcs;
7775 package = go.stdenv.mkDerivation (
78− (builtins.removeAttrs args [ "goPackageAliases" "disabled" ]) // {
76+ (builtins.removeAttrs args [ "goPackageAliases" "disabled" "extraSrcs"]) // {
7977
8078 nativeBuildInputs = [ removeReferencesTo go ]
8179 ++ (lib.optional (!dontRenameImports) govers) ++ nativeBuildInputs;