diff --git a/hack/update-vendor.sh b/hack/update-vendor.sh index b44e6b0b84a..80d14b5cbbd 100755 --- a/hack/update-vendor.sh +++ b/hack/update-vendor.sh @@ -240,6 +240,14 @@ for repo in $(tsort "${TMP_DIR}/tidy_deps.txt"); do $(go mod why ${loopback_deps})" exit 1 fi + + # prune unused pinned replace directives + comm -23 \ + <(go mod edit -json | jq -r '.Replace[] | select(.Old.Path == .New.Path) | select(.New.Version != null) | .Old.Path' | sort) \ + <(go list -m -json all | jq -r .Path | sort) | + xargs -L 1 -I {} echo "-dropreplace={}" | + xargs -L 100 go mod edit -fmt + popd >/dev/null 2>&1 done echo "=== tidying root" >> "${LOG_FILE}"