File: check-go-mod-version.sh

package info (click to toggle)
prometheus 2.53.5%2Bds1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,456 kB
  • sloc: javascript: 2,423; yacc: 758; sh: 431; makefile: 231; lex: 189
file content (12 lines) | stat: -rwxr-xr-x 295 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env bash

readarray -t mod_files < <(find . -type f -name go.mod)

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'
  exit 1
fi