chore: add checkgenerate test to lint (#404)

This commit is contained in:
Dane Strandboge 2022-06-23 10:07:38 -05:00 committed by GitHub
parent 09881c0214
commit 85c690f1f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 0 deletions

View File

@ -274,6 +274,10 @@ jobs:
name: staticcheck
command: make staticcheck
when: always
- run:
name: Check generate
command: make checkgenerate
when: always
check-openapi:
executor: linux-amd64

View File

@ -64,6 +64,9 @@ checktidy:
checkopenapi:
./etc/checkopenapi.sh
checkgenerate:
./etc/checkgenerate.sh
staticcheck: $(SOURCES)
go run honnef.co/go/tools/cmd/staticcheck -go $(GOVERSION) ./...

16
etc/checkgenerate.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
set -e
function check_changes () {
changes="$(git status --porcelain=v1 2>/dev/null)"
if [ -n "$changes" ] ; then
echo $1
echo "$changes"
exit 1
fi
}
check_changes "git is dirty before running 'make generate-sources!'"
make mock
check_changes "git is dirty after running 'make generate-sources'!"