Compare commits
1 Commits
043aabbd27
...
426a8d7645
| Author | SHA1 | Date | |
|---|---|---|---|
| 426a8d7645 |
18
script/lint
18
script/lint
@@ -176,23 +176,7 @@ prune_dead_caches() {
|
||||
continue
|
||||
fi
|
||||
if [ ! -d "$owner" ]; then
|
||||
# The Go module cache inside is deliberately read-only, and
|
||||
# rm(1) cannot unlink a file out of a directory it may not
|
||||
# write, so the tree has to be made writable first. And
|
||||
# failing to tidy up is a housekeeping problem, never a
|
||||
# reason to fail a lint: without the fallback below, `set
|
||||
# -e` turns a stale cache that will not delete into a lint
|
||||
# error, which is a gate failing for a reason that has
|
||||
# nothing to do with the code. (Observed, not theorised.)
|
||||
chmod -R u+w "$dir" 2>/dev/null || true
|
||||
if ! rm -rf "$dir" 2>/dev/null; then
|
||||
# Restore the marker on a partial removal: an
|
||||
# unmarked leftover would be skipped by every future
|
||||
# run and never collected.
|
||||
mkdir -p "$dir" 2>/dev/null || true
|
||||
echo "$owner" >"$dir/worktree" 2>/dev/null || true
|
||||
echo "lint: could not remove stale cache $dir" >&2
|
||||
fi
|
||||
rm -rf "$dir"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user