0c64f18815
* chore(retract): miss paths, second round * chore(retract): root retraction tags for tilde phantom paths * fix(retract): skip blank lines during path dedup Empty base buckets emit one blank line from printf; mapfile then reads it as an empty element, inflating the total and creating bogus one-path orphan commits. Filter blank lines before dedup. * fix(retract): push tag batches without array slicing --------- Co-authored-by: Alex Serheyev <74361701+alex-dna-tech@users.noreply.github.com> Co-authored-by: Codex <codex@openai.com>
52 lines
1.2 KiB
Bash
Executable File
52 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# check-versions.sh — Run `go list -m -versions` for every phantom module path
|
|
# declared in retract-phantom.sh.
|
|
#
|
|
# Usage: ./check-versions.sh [--dry-run]
|
|
#
|
|
# --dry-run print the paths only, without running go list
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
SOURCE="$SCRIPT_DIR/retract-phantom.sh"
|
|
|
|
DRY_RUN=false
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--dry-run) DRY_RUN=true ;;
|
|
esac
|
|
done
|
|
|
|
if [[ ! -f "$SOURCE" ]]; then
|
|
echo "error: $SOURCE not found" >&2
|
|
exit 1
|
|
fi
|
|
|
|
mapfile -t PATHS < <(
|
|
awk '
|
|
/^PHANTOM_PATHS=\(/ { in_arr = 1; next }
|
|
in_arr && /^\)/ { exit }
|
|
in_arr {
|
|
gsub(/^[[:space:]]+|[[:space:]]+$/, "")
|
|
if ($0 != "" && $0 !~ /^#/) print
|
|
}
|
|
' "$SOURCE"
|
|
)
|
|
|
|
if [[ ${#PATHS[@]} -eq 0 ]]; then
|
|
echo "error: no phantom paths parsed from $SOURCE" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "checking ${#PATHS[@]} phantom module paths"
|
|
for path in "${PATHS[@]}"; do
|
|
if $DRY_RUN; then
|
|
echo "$path"
|
|
continue
|
|
fi
|
|
printf '%-70s ' "$path"
|
|
go list -m -versions "$path" 2>/dev/null || printf '(no versions found)'
|
|
echo
|
|
done
|