Skip to content

Commit

Permalink
buildGoModule: simplify go-module attribute structure without rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
ShamrockLee committed May 27, 2023
1 parent afdc28a commit 6634a21
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions pkgs/build-support/go/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ assert (args' ? vendorHash && args' ? vendorSha256) -> throw "both `vendorHash`
let
args = removeAttrs args' [ "overrideModAttrs" "vendorSha256" "vendorHash" ];

go-modules = if (vendorHash != null) then stdenv.mkDerivation (let modArgs = {
go-modules = if (vendorHash == null) then "" else
(stdenv.mkDerivation {

name = "${name}-go-modules";

Expand Down Expand Up @@ -138,13 +139,11 @@ let
'';

dontFixup = true;
}; in modArgs // (
{
outputHashMode = "recursive";
outputHash = vendorHash;
outputHashAlgo = if args' ? vendorSha256 || vendorHash == "" then "sha256" else null;
}
) // overrideModAttrs modArgs) else "";

outputHashMode = "recursive";
outputHash = vendorHash;
outputHashAlgo = if args' ? vendorSha256 || vendorHash == "" then "sha256" else null;
}).overrideAttrs overrideModAttrs;

package = stdenv.mkDerivation (args // {
nativeBuildInputs = [ go ] ++ nativeBuildInputs;
Expand Down

0 comments on commit 6634a21

Please sign in to comment.