aks-operator/scripts/validate

41 lines
771 B
Bash
Executable File

#!/bin/bash
set -e
cd $(dirname $0)/..
if ! command -v golangci-lint; then
echo Skipping validation: no golangci-lint available
exit
fi
echo 'Running: golangci-lint'
golangci-lint run
echo 'Running: go mod verify'
go mod verify
echo 'Running: go fmt'
go fmt
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
echo 'go fmt produced differences'
exit 1
fi
echo 'Running: go generate'
go generate
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
echo 'go generate produced differences'
exit 1
fi
echo 'Running: go mod tidy'
go mod tidy
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
echo 'go mod tidy produced differences'
exit 1
fi
echo 'Running: go test'
go test -cover -tags=test ./pkg/aks/...