#! /bin/bash set -e cd $(dirname $0)/.. echo "Validating" if [[ ! $(command -v golangci-lint) ]]; then echo Skipping validation: no golangci-lint available else echo Running: golangci-lint golangci-lint run fi if [[ -z $(type -p "mockgen") ]]; then echo "'mockgen': executable file not found in \$PATH. mockgen is needed to compelete code generation." echo "Install mockgen with 'go install go.uber.org/mock/mockgen@v0.5.0'" exit 1 fi echo Running: go generate go generate ./... echo Tidying up modules go mod tidy echo Verifying modules go mod verify if [ -n "$(git status --porcelain --untracked-files=no)" ]; then echo "Encountered dirty repo!" exit 1 fi echo "Running Test" go test ./...