Fix shellcheck failures on clean.sh and cache_go_dirs.sh

update pull request
k3s-v1.15.3
aaa 2019-04-19 13:36:23 -04:00
parent ac1557a886
commit 5f719707f2
3 changed files with 7 additions and 9 deletions

View File

@ -30,8 +30,6 @@
./hack/lib/swagger.sh
./hack/lib/test.sh
./hack/lib/version.sh
./hack/make-rules/clean.sh
./hack/make-rules/helpers/cache_go_dirs.sh
./hack/make-rules/make-help.sh
./hack/make-rules/test.sh
./hack/make-rules/update.sh

View File

@ -18,7 +18,7 @@ set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../..
source "${KUBE_ROOT}/hack/lib/util.sh"
CLEAN_PATTERNS=(
@ -28,11 +28,11 @@ CLEAN_PATTERNS=(
"test/e2e/generated/bindata.go"
)
for pattern in ${CLEAN_PATTERNS[@]}; do
for match in $(find "${KUBE_ROOT}" -iregex "^${KUBE_ROOT}/${pattern}$"); do
for pattern in "${CLEAN_PATTERNS[@]}"; do
while IFS=$'\n' read -r -d match; do
echo "Removing ${match#${KUBE_ROOT}\/} .."
rm -rf "${match#${KUBE_ROOT}\/}"
done
done < <(find "${KUBE_ROOT}" -iregex "^${KUBE_ROOT}/${pattern}$")
done
# ex: ts=2 sw=2 et filetype=sh

View File

@ -28,7 +28,7 @@ if [[ -z "${1:-}" ]]; then
fi
CACHE="$1"; shift
trap "rm -f '${CACHE}'" HUP INT TERM ERR
trap 'rm -f "${CACHE}"' HUP INT TERM ERR
# This is a partial 'find' command. The caller is expected to pass the
# remaining arguments.
@ -62,8 +62,8 @@ if [[ -f "${CACHE}" ]]; then
N=$(kfind -type d -newer "${CACHE}" -print -quit | wc -l)
[[ "${N}" == 0 ]] && NEED_FIND=false
fi
mkdir -p $(dirname "${CACHE}")
if $("${NEED_FIND}"); then
mkdir -p "$(dirname "${CACHE}")"
if ${NEED_FIND}; then
kfind -type f -name \*.go \
| sed 's|/[^/]*$||' \
| sed 's|^./||' \