buildGoModule: supported structuredAttrs with subPackages (#519903)

This commit is contained in:
Matt Sturgeon
2026-07-04 01:49:49 +00:00
committed by GitHub
2 changed files with 10 additions and 4 deletions

View File

@@ -320,10 +320,15 @@ lib.extendMkDerivation {
}
getGoDirs() {
local type;
type="$1"
if [ -n "$subPackages" ]; then
echo "$subPackages" | sed "s,\(^\| \),\1./,g"
local -r type="$1"
# Support strucuredAttrs, they are not space seperated
local -a subPackagesArray
concatTo subPackagesArray subPackages
# Outputs each element prefixed with './' if the array is not empty
if [[ ''${#subPackagesArray[@]} -gt 0 ]]; then
echo "''${subPackagesArray[*]/#/./}"
else
find . -type f -name \*$type.go -exec dirname {} \; | grep -v "/vendor/" | sort --unique | grep -v "$exclude"
fi

View File

@@ -15,6 +15,7 @@ buildGoModule (finalAttrs: {
hash = "sha256-DmIjqBTIzwkQ8aJ6xCgIwjDtczlTH5AKbPKFUGx3qQ8=";
};
__structuredAttrs = true;
vendorHash = "sha256-gBURmodXkod4fukw6LWEY+MBxPcf4vn/f6K78UR77n0=";
modRoot = "./cmd";