From f250dcf70ac0216ece4aa7b5c0d4c3c38e5ee600 Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Mon, 8 Apr 2019 09:24:13 -0400 Subject: [PATCH] Prune unneeded replace directives from staging go.mod files --- hack/update-vendor.sh | 8 ++++++++ 1 file changed, 8 insertions(+) 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}"