jeol-t330a/succbone/succd/ci.sh

31 lines
567 B
Bash
Raw Normal View History

2024-09-28 13:28:49 +00:00
#!/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."