Skip to content

Commit f279c4c

Browse files
authored
Update go version checker (#458)
* Handle new files (old version is empty) * Handle the case where .0 patch is added/removed Signed-off-by: Todd Short <[email protected]>
1 parent b30eb4a commit f279c4c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

hack/scripts/check-go-version.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ for f in $(find . -name "*.mod"); do
6363
old=${old#go }
6464
new=$(git grep -ohP '^go .*$' "${f}")
6565
new=${new#go }
66+
# If ${old} is empty, it means this is a new .mod file
67+
if [ -z "${old}" ]; then
68+
continue
69+
fi
70+
# Check if patch version remains 0: X.x.0 <-> X.x
71+
if [ "${new}.0" == "${old}" -o "${new}" == "${old}.0" ]; then
72+
continue
73+
fi
6674
if [ "${new}" != "${old}" ]; then
6775
echo "${f}: ${v}: Updated golang version from ${old}"
6876
RETCODE=1

0 commit comments

Comments
 (0)