k3s/scripts/validate

42 lines
876 B
Plaintext
Raw Normal View History

2019-01-01 08:23:01 +00:00
#!/bin/bash
set -e
cd $(dirname $0)/..
echo Running validation
PACKAGES="$(go list ./...)"
if [ ! -e build/data ];then
mkdir -p build/data
fi
go generate
echo Running: go vet
go vet ${PACKAGES}
2019-01-01 08:23:01 +00:00
echo Running: gometalinter
for i in ${PACKAGES}; do
if [ -n "$(gometalinter $i | \
2019-01-09 16:54:15 +00:00
grep -v 'pkg/data/zz_generated_bindata.go' | \
2019-01-01 08:23:01 +00:00
grep -v 'should have comment.*or be unexported' | \
grep -v 'cli/cmd.*don.t use underscores in Go name' | \
grep -v 'cli/cmd.*should be DNS' | \
tee /dev/stderr)" ]; then
failed=true
fi
done
test -z "$failed"
echo Running: go fmt
2019-01-09 16:54:15 +00:00
test -z "$(go fmt ${PACKAGES} | \
grep -v 'pkg/data/zz_generated_bindata.go' | \
tee /dev/stderr)"
. ./scripts/version.sh
if [ -n "$DIRTY" ]; then
echo Source dir is dirty
git status --porcelain --untracked-files=no
2019-01-24 17:57:19 +00:00
exit 1
fi