buildGoPackage: check/delete vendor
This commit is contained in:
@@ -29,6 +29,9 @@
|
||||
# go2nix dependency file
|
||||
, goDeps ? null
|
||||
|
||||
# Whether to delete the vendor folder supplied with the source.
|
||||
, deleteVendor ? false
|
||||
|
||||
, dontRenameImports ? false
|
||||
|
||||
# Do not enable this without good reason
|
||||
@@ -96,6 +99,18 @@ let
|
||||
mkdir -p "go/src/$(dirname "$goPackagePath")"
|
||||
mv "$sourceRoot" "go/src/$goPackagePath"
|
||||
|
||||
'' + lib.optionalString (deleteVendor == true) ''
|
||||
if [ ! -d "go/src/$goPackagePath/vendor" ]; then
|
||||
echo "vendor folder does not exist, 'deleteVendor' is not needed"
|
||||
exit 10
|
||||
else
|
||||
rm -rf "go/src/$goPackagePath/vendor"
|
||||
fi
|
||||
'' + lib.optionalString (goDeps != null) ''
|
||||
if [ -d "go/src/$goPackagePath/vendor" ]; then
|
||||
echo "vendor folder exists, 'goDeps' is not needed"
|
||||
exit 10
|
||||
fi
|
||||
'' + lib.flip lib.concatMapStrings goPath ({ src, goPackagePath }: ''
|
||||
mkdir goPath
|
||||
(cd goPath; unpackFile "${src}")
|
||||
|
||||
Reference in New Issue
Block a user