From 187def4d4fdb99115dbf0dd27734e500dc40d824 Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Wed, 20 Jan 2021 12:32:44 -0800 Subject: [PATCH] Make: Retool how we cache go dirs Now we can use /dev/null as an argument when running tools manually --- hack/make-rules/helpers/cache_go_dirs.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/hack/make-rules/helpers/cache_go_dirs.sh b/hack/make-rules/helpers/cache_go_dirs.sh index e38b64768be..63cb07d422f 100755 --- a/hack/make-rules/helpers/cache_go_dirs.sh +++ b/hack/make-rules/helpers/cache_go_dirs.sh @@ -54,19 +54,19 @@ function kfind() { | sed 's|^./staging/src|vendor|' } -NEED_FIND=true # It's *significantly* faster to check whether any directories are newer than # the cache than to blindly rebuild it. -if [[ -f "${CACHE}" ]]; then +if [[ -f "${CACHE}" && -n "${CACHE}" ]]; then N=$(kfind -type d -newer "${CACHE}" -print -quit | wc -l) - [[ "${N}" == 0 ]] && NEED_FIND=false + if [[ "${N}" == 0 ]]; then + cat "${CACHE}" + exit + fi fi + mkdir -p "$(dirname "${CACHE}")" -if ${NEED_FIND}; then - kfind -type f -name \*.go \ - | sed 's|/[^/]*$||' \ - | sed 's|^./||' \ - | LC_ALL=C sort -u \ - > "${CACHE}" -fi -cat "${CACHE}" +kfind -type f -name \*.go \ + | sed 's|/[^/]*$||' \ + | sed 's|^./||' \ + | LC_ALL=C sort -u \ + | tee "${CACHE}"