Merge pull request #17826 from roidelapluie/roidelapluie/goworkversion

scripts: use git ls-files and check go.work files in version check
This commit is contained in:
Julien 2026-01-20 12:50:26 +01:00 committed by GitHub
commit 2193782b1d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,12 +1,12 @@
#!/usr/bin/env bash
readarray -t mod_files < <(find . -type f -name go.mod)
readarray -t mod_files < <(git ls-files go.mod go.work '*/go.mod' || find . -type f -name go.mod -or -name go.work)
echo "Checking files ${mod_files[@]}"
matches=$(awk '$1 == "go" {print $2}' "${mod_files[@]}" | sort -u | wc -l)
if [[ "${matches}" -ne 1 ]]; then
echo 'Not all go.mod files have matching go versions'
echo 'Not all go.mod/go.work files have matching go versions'
exit 1
fi