mirror of
https://github.com/prometheus/prometheus.git
synced 2026-02-03 20:39:32 -05:00
Update check-go-mod-version.sh to use git ls-files instead of find for better performance and to respect .gitignore. Also include go.work files in the version check to ensure consistency across workspace files and modules. Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
12 lines
363 B
Bash
Executable file
12 lines
363 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
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/go.work files have matching go versions'
|
|
exit 1
|
|
fi
|