31 lines
567 B
Bash
31 lines
567 B
Bash
|
#!/usr/bin/env bash
|
||
|
set -e
|
||
|
set -o pipefail
|
||
|
|
||
|
if [ ! -f go.mod ]; then
|
||
|
echo "Script needs to be run with in succd directory."
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
echo "Running gofmt..."
|
||
|
GOFMT_OUT="$(gofmt -d $(find . -name '*.go'))"
|
||
|
if [ -n "$GOFMT_OUT" ]; then
|
||
|
echo "gofmt generated differences, please run 'go fmt ./' and try again."
|
||
|
echo "$GOFMT_OUT"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
echo "Running govet..."
|
||
|
GOVET_OUT="$(go vet ./)"
|
||
|
if [ -n "$GOVET_OUT" ]; then
|
||
|
echo "go vet found the following errors:"
|
||
|
echo "$GOVET_OUT"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
echo "Running tests..."
|
||
|
go test ./
|
||
|
|
||
|
echo "OK."
|
||
|
|