From aaa8802acb037bea47fd6a5daebc96fbf9acc72f Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Fri, 12 Apr 2019 16:37:51 -0400 Subject: [PATCH] Prune unnecessary replace directives from staging go.mod files --- hack/update-vendor.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hack/update-vendor.sh b/hack/update-vendor.sh index 80d14b5cbbd..508f8ba61f1 100755 --- a/hack/update-vendor.sh +++ b/hack/update-vendor.sh @@ -243,11 +243,19 @@ $(go mod why ${loopback_deps})" # 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 mod edit -json | jq -r '.Replace[] | .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 + # prune replace directives that pin to the naturally selected version + go list -m -json all | + jq -r 'select(.Replace != null) | + select(.Path == .Replace.Path) | + select(.Version == .Replace.Version) | + "-dropreplace \(.Replace.Path)"' | + xargs -L 100 go mod edit -fmt + popd >/dev/null 2>&1 done echo "=== tidying root" >> "${LOG_FILE}"