Skip to content

Commit f250dcf

Browse files
committed
Prune unneeded replace directives from staging go.mod files
1 parent fdd241a commit f250dcf

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

hack/update-vendor.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,14 @@ for repo in $(tsort "${TMP_DIR}/tidy_deps.txt"); do
240240
$(go mod why ${loopback_deps})"
241241
exit 1
242242
fi
243+
244+
# prune unused pinned replace directives
245+
comm -23 \
246+
<(go mod edit -json | jq -r '.Replace[] | select(.Old.Path == .New.Path) | select(.New.Version != null) | .Old.Path' | sort) \
247+
<(go list -m -json all | jq -r .Path | sort) |
248+
xargs -L 1 -I {} echo "-dropreplace={}" |
249+
xargs -L 100 go mod edit -fmt
250+
243251
popd >/dev/null 2>&1
244252
done
245253
echo "=== tidying root" >> "${LOG_FILE}"

0 commit comments

Comments
 (0)