go-modules: Add useVend flag to go-modules
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
{ go, cacert, git, lib, removeReferencesTo, stdenv }:
|
||||
{ go, cacert, git, lib, removeReferencesTo, stdenv, vend }:
|
||||
|
||||
{ name ? "${args'.pname}-${args'.version}"
|
||||
, src
|
||||
@@ -20,6 +20,9 @@
|
||||
, vendorSha256
|
||||
# Whether to delete the vendor folder supplied with the source.
|
||||
, deleteVendor ? false
|
||||
# Whether to run the vend tool to regenerate the vendor directory.
|
||||
# This is useful if any dependency contain C files.
|
||||
, runVend ? false
|
||||
|
||||
, modSha256 ? null
|
||||
|
||||
@@ -48,6 +51,8 @@ let
|
||||
|
||||
deleteFlag = if deleteVendor then "true" else "false";
|
||||
|
||||
vendCommand = if runVend then "${vend}/bin/vend" else "false";
|
||||
|
||||
go-modules = if vendorSha256 != null then go.stdenv.mkDerivation (let modArgs = {
|
||||
|
||||
name = "${name}-go-modules";
|
||||
@@ -87,7 +92,13 @@ let
|
||||
echo "vendor folder exists, please set 'vendorSha256=null;' or 'deleteVendor=true;' in your expression"
|
||||
exit 10
|
||||
fi
|
||||
go mod vendor
|
||||
|
||||
if [ ${vendCommand} != "false" ]; then
|
||||
echo running vend to rewrite vendor folder
|
||||
${vendCommand}
|
||||
else
|
||||
go mod vendor
|
||||
fi
|
||||
mkdir -p vendor
|
||||
|
||||
runHook postBuild
|
||||
|
||||
Reference in New Issue
Block a user