From 08a74f24c462f8d03696137af1c1fea3725613e6 Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Thu, 25 Jul 2024 09:31:45 -0400 Subject: [PATCH] Fix verify-vendor script to check all go.mod and go.sum files --- hack/verify-vendor.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/hack/verify-vendor.sh b/hack/verify-vendor.sh index 0fea7224a7f..dbdefedae39 100755 --- a/hack/verify-vendor.sh +++ b/hack/verify-vendor.sh @@ -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