Compare commits
1 Commits
426a8d7645
...
043aabbd27
| Author | SHA1 | Date | |
|---|---|---|---|
| 043aabbd27 |
18
script/lint
18
script/lint
@@ -176,7 +176,23 @@ prune_dead_caches() {
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
if [ ! -d "$owner" ]; then
|
if [ ! -d "$owner" ]; then
|
||||||
rm -rf "$dir"
|
# 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
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user