Fix verify-vendor script to check all go.mod and go.sum files

This commit is contained in:
Jordan Liggitt 2024-07-25 09:31:45 -04:00
parent b95f9c32d6
commit 08a74f24c4
No known key found for this signature in database

View File

@ -62,15 +62,17 @@ popd > /dev/null 2>&1
ret=0
pushd "${KUBE_ROOT}" > /dev/null 2>&1
# Test for diffs
if ! _out="$(diff -Naupr --ignore-matching-lines='^\s*\"GoVersion\":' go.mod "${_kubetmp}/go.mod")"; then
echo "Your go.mod file is different:" >&2
echo "${_out}" >&2
echo "Vendor Verify failed." >&2
echo "If you're seeing this locally, run the below command to fix your go.mod:" >&2
echo "hack/update-vendor.sh" >&2
ret=1
fi
# Test for diffs in go.mod / go.sum / go.work
for file in $(git ls-files -cmo --exclude-standard -- ':!:vendor/*' ':(glob)**/go.mod' ':(glob)**/go.sum' ':(glob)**/go.work'); do
if ! _out="$(diff -Naupr "${file}" "${_kubetmp}/${file}")"; then
echo "Your ${file} file is different:" >&2
echo "${_out}" >&2
echo "Vendor Verify failed." >&2
echo "If you're seeing this locally, run the below command to fix this:" >&2
echo "hack/update-vendor.sh" >&2
ret=1
fi
done
if ! _out="$(diff -Naupr -x "AUTHORS*" -x "CONTRIBUTORS*" vendor "${_kubetmp}/vendor")"; then
echo "Your vendored results are different:" >&2