diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh index 410032cc703..ca44f0f103a 100755 --- a/hack/lib/golang.sh +++ b/hack/lib/golang.sh @@ -964,6 +964,7 @@ kube::golang::build_binaries() { if [[ ${#targets[@]} -eq 0 ]]; then targets=("${KUBE_ALL_TARGETS[@]}") fi + kube::util::read-array targets < <(kube::golang::dedup "${targets[@]}") local -a platforms IFS=" " read -ra platforms <<< "${KUBE_BUILD_PLATFORMS:-}" @@ -972,7 +973,7 @@ kube::golang::build_binaries() { fi local -a binaries - while IFS="" read -r binary; do binaries+=("$binary"); done < <(kube::golang::binaries_from_targets "${targets[@]}") + kube::util::read-array binaries < <(kube::golang::binaries_from_targets "${targets[@]}") local parallel=false if [[ ${#platforms[@]} -gt 1 ]]; then diff --git a/hack/lib/util.sh b/hack/lib/util.sh index 70568f76fa6..a16f6e57473 100755 --- a/hack/lib/util.sh +++ b/hack/lib/util.sh @@ -832,8 +832,8 @@ function kube::util::md5() { # kube::util::read-array # Reads in stdin and adds it line by line to the array provided. This can be # used instead of "mapfile -t", and is bash 3 compatible. If the named array -# exists and is an array, it will be used. Otherwise it will be unset and -# recreated. +# exists and is an array, it will be overwritten. Otherwise it will be unset +# and recreated. # # Assumed vars: # $1 (name of array to create/modify)