Skip to content

Commit 5f71970

Browse files
committed
Fix shellcheck failures on clean.sh and cache_go_dirs.sh
update pull request
1 parent ac1557a commit 5f71970

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

hack/.shellcheck_failures

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
./hack/lib/swagger.sh
3131
./hack/lib/test.sh
3232
./hack/lib/version.sh
33-
./hack/make-rules/clean.sh
34-
./hack/make-rules/helpers/cache_go_dirs.sh
3533
./hack/make-rules/make-help.sh
3634
./hack/make-rules/test.sh
3735
./hack/make-rules/update.sh

hack/make-rules/clean.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ set -o errexit
1818
set -o nounset
1919
set -o pipefail
2020

21-
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
21+
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../..
2222
source "${KUBE_ROOT}/hack/lib/util.sh"
2323

2424
CLEAN_PATTERNS=(
@@ -28,11 +28,11 @@ CLEAN_PATTERNS=(
2828
"test/e2e/generated/bindata.go"
2929
)
3030

31-
for pattern in ${CLEAN_PATTERNS[@]}; do
32-
for match in $(find "${KUBE_ROOT}" -iregex "^${KUBE_ROOT}/${pattern}$"); do
31+
for pattern in "${CLEAN_PATTERNS[@]}"; do
32+
while IFS=$'\n' read -r -d match; do
3333
echo "Removing ${match#${KUBE_ROOT}\/} .."
3434
rm -rf "${match#${KUBE_ROOT}\/}"
35-
done
35+
done < <(find "${KUBE_ROOT}" -iregex "^${KUBE_ROOT}/${pattern}$")
3636
done
3737

3838
# ex: ts=2 sw=2 et filetype=sh

hack/make-rules/helpers/cache_go_dirs.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ if [[ -z "${1:-}" ]]; then
2828
fi
2929
CACHE="$1"; shift
3030

31-
trap "rm -f '${CACHE}'" HUP INT TERM ERR
31+
trap 'rm -f "${CACHE}"' HUP INT TERM ERR
3232

3333
# This is a partial 'find' command. The caller is expected to pass the
3434
# remaining arguments.
@@ -62,8 +62,8 @@ if [[ -f "${CACHE}" ]]; then
6262
N=$(kfind -type d -newer "${CACHE}" -print -quit | wc -l)
6363
[[ "${N}" == 0 ]] && NEED_FIND=false
6464
fi
65-
mkdir -p $(dirname "${CACHE}")
66-
if $("${NEED_FIND}"); then
65+
mkdir -p "$(dirname "${CACHE}")"
66+
if ${NEED_FIND}; then
6767
kfind -type f -name \*.go \
6868
| sed 's|/[^/]*$||' \
6969
| sed 's|^./||' \

0 commit comments

Comments
 (0)