@@ -1,4 +1,4 @@
1−{ go, cacert, git, lib, removeReferencesTo, stdenv, vend }:
1+{ go, cacert, git, lib, stdenv, vend }:
22
33{ name ? "${args'.pname}-${args'.version}"
44, src
@@ -43,10 +43,6 @@ with builtins;
4343let
4444 args = removeAttrs args' [ "overrideModAttrs" "vendorSha256" "disabled" ];
4545
46− removeReferences = [ ] ++ lib.optional (!allowGoReference) go;
47−
48− removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}'';
49−
5046 go-modules = if vendorSha256 != null then go.stdenv.mkDerivation (let modArgs = {
5147
5248 name = "${name}-go-modules";
@@ -121,12 +117,12 @@ let
121117 ) // overrideModAttrs modArgs) else "";
122118
123119 package = go.stdenv.mkDerivation (args // {
124− nativeBuildInputs = [ removeReferencesTo go ] ++ nativeBuildInputs;
120+ nativeBuildInputs = [ go ] ++ nativeBuildInputs;
125121
126122 inherit (go) GOOS GOARCH;
127123
128124 GO111MODULE = "on";
129− GOFLAGS = "-mod=vendor";
125+ GOFLAGS = [ "-mod=vendor" ] ++ lib.optionals (!allowGoReference) [ "-trimpath" ];
130126
131127 configurePhase = args.configurePhase or ''
132128 runHook preConfigure
@@ -229,10 +225,6 @@ let
229225 runHook postInstall
230226 '';
231227
232− preFixup = (args.preFixup or "") + ''
233− find $out/{bin,libexec,lib} -type f 2>/dev/null | xargs -r ${removeExpr removeReferences} || true
234− '';
235−
236228 strictDeps = true;
237229
238230 disallowedReferences = lib.optional (!allowGoReference) go;