Skip to content

Commit

Permalink
Add go mod version test
Browse files Browse the repository at this point in the history
Add a script to make sure go.mod Go versions stay in sync.

Signed-off-by: SuperQ <superq@gmail.com>
  • Loading branch information
SuperQ committed Dec 10, 2022
1 parent 00e3fd7 commit 82accf3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Expand Up @@ -76,6 +76,7 @@ jobs:
- run: make style
- run: make -C sigv4 style
- run: make -C assets style
- run: make check-go-mod-version
- when:
condition: << parameters.use_gomod_cache >>
steps:
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Expand Up @@ -19,3 +19,8 @@ test:: deps check_license unused common-test lint
.PHONY: generate-testdata
generate-testdata:
@cd config && go run generate.go

.PHONY: check-go-mod-version
check-go-mod-version:
@echo ">> checking go.mod version matching"
@./scripts/check-go-mod-version.sh
12 changes: 12 additions & 0 deletions scripts/check-go-mod-version.sh
@@ -0,0 +1,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

0 comments on commit 82accf3

Please sign in to comment.