From 9fd97dab12984fb79e26ea1f342dce8ee120338e Mon Sep 17 00:00:00 2001 From: Sam Dowell Date: Thu, 27 Jan 2022 20:14:37 +0000 Subject: [PATCH] ci: use array for mozilla_repos Update mozilla_repos to use an array rather than a string with space delimited elements. This is intended to provide a more straightforward type for storing a list of elements as well as provide more explicit word splitting in line with SC2086. --- scripts/create-licenses.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/create-licenses.sh b/scripts/create-licenses.sh index bf1296cb43..cc5d7f76d1 100755 --- a/scripts/create-licenses.sh +++ b/scripts/create-licenses.sh @@ -168,7 +168,7 @@ V2_LICENSE_DIR="vendor/github.com/cpuguy83/go-md2man" mv ${V2_LICENSE_DIR}/v2/LICENSE ${V2_LICENSE_DIR} # Loop through every vendored package -mozilla_repos="" +mozilla_repos=() for PACKAGE in $(go list -mod=mod -m -json all | jq -r .Path | sort -f); do if [[ -e "staging/src/${PACKAGE}" ]]; then # echo "$PACKAGE is a staging package, skipping" > /dev/stderr @@ -224,7 +224,7 @@ __EOF__ license=$(cat "${file}") if [[ "$license" == *"Mozilla"* ]] then - mozilla_repos+=" ${DEPS_DIR}/${PACKAGE}" + mozilla_repos+=("${DEPS_DIR}/${PACKAGE}") fi cat ${file} @@ -242,7 +242,7 @@ README="${KUBE_ROOT}/scripts/docs/create-licenses/README.md" zip -q "${ZIP_FILENAME}" "${README}" # Create a package of Mozilla repository source code (only go code). -[ -n "$mozilla_repos" ] && zip -qur $ZIP_FILENAME $mozilla_repos -i '*.go' +[ ${#mozilla_repos[@]} != 0 ] && zip -qur "${ZIP_FILENAME}" "${mozilla_repos[@]}" -i '*.go' # Cleanup vendor directory rm -rf vendor