Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add go mod version test #422

Merged
merged 1 commit into from Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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