Skip to content

Commit

Permalink
ci: use array for mozilla_repos
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sdowell committed Jan 28, 2022
1 parent c83db69 commit 9fd97da
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/create-licenses.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand All @@ -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

0 comments on commit 9fd97da

Please sign in to comment.