buildGoModule: supported structuredAttrs with subPackages

This commit is contained in:
Ross Smyth 2026-05-13 16:05:47 -04:00
commit f52e868a2e

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