Prune unneeded replace directives from staging go.mod files

This commit is contained in:
Jordan Liggitt 2019-04-08 09:24:13 -04:00
parent fdd241a858
commit f250dcf70a

View File

@ -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}"