diff --git a/pkgs/build-support/go/module.nix b/pkgs/build-support/go/module.nix index ea266422c6d8..a98f89f5e730 100644 --- a/pkgs/build-support/go/module.nix +++ b/pkgs/build-support/go/module.nix @@ -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