Skip to content

Aggregator sequence and postgres implementation #431

Aggregator sequence and postgres implementation

Aggregator sequence and postgres implementation #431

name: Go Version Consistency Check
on:
pull_request:
paths:
- '**/go.mod'
- 'tool-versions.env'
- '.github/**'
push:
branches:
- main
paths:
- '**/go.mod'
- 'tool-versions.env'
- '.github/**'
workflow_dispatch:
jobs:
check-go-version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Read expected Go version
id: tool_versions
shell: bash
run: |
set -euo pipefail
if ! grep -qE '^VERSION_GO=' tool-versions.env; then
echo "VERSION_GO= not found in tool-versions.env"
exit 1
fi
go_version_full=$(grep -E '^VERSION_GO=' tool-versions.env | cut -d= -f2)
echo "full=$go_version_full" >> $GITHUB_OUTPUT
- name: Enforce go.mod Go versions
env:
EXPECTED_GO_FULL: ${{ steps.tool_versions.outputs.full }}
shell: bash
run: |
set -euo pipefail
files=$(git ls-files | grep -E '(^|/)go\.mod$' || true)
if [ -z "$files" ]; then
echo "No go.mod files found."
exit 0
fi
failed=0
for gomod in $files; do
declared=$(grep -E '^go [0-9]+\.[0-9]+' "$gomod" | awk '{print $2}' | head -n1 || true)
if [ -z "$declared" ]; then
echo "❌ Missing 'go' directive in $gomod"
failed=1
continue
fi
if [ "$declared" != "$EXPECTED_GO_FULL" ]; then
echo "❌ $gomod: go $declared != expected go $EXPECTED_GO_FULL (from tool-versions.env)"
failed=1
fi
done
if [ "$failed" -ne 0 ]; then
echo
echo "Please update 'go' directives to 'go $EXPECTED_GO_FULL' in all go.mod files."
exit 1
fi
echo "✅ All go.mod files use go $EXPECTED_GO_FULL."