Tweak test, update-fmt, add verify-fmt

Remove verifying gofmt from hack/test.sh.
Make sure hack/update-fmt.sh ignores zz_generated files.
Enable code simplification for gofmt.
Add hack/verify-fmt.sh.

Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
This commit is contained in:
Andy Goldstein
2017-10-26 17:21:06 -04:00
parent 78dc641b15
commit 64632e29f8
3 changed files with 34 additions and 30 deletions

View File

@@ -25,31 +25,4 @@ TARGETS=$(for d in "$@"; do echo ./$d/...; done)
echo "Running tests:"
go test -i -installsuffix "static" ${TARGETS}
go test -installsuffix "static" -timeout 60s ${TARGETS}
echo
echo -n "Checking gofmt: "
ERRS=$(find "$@" -type f -name \*.go | xargs gofmt -l 2>&1 || true)
if [ -n "${ERRS}" ]; then
echo "FAIL - the following files need to be gofmt'ed:"
for e in ${ERRS}; do
echo " $e"
done
echo
exit 1
fi
echo "PASS"
echo
# TODO(ncdc): there are govet failures in the generated clientset and the log error location hook
# that prevent us from running vet at this time.
#
# echo -n "Checking go vet: "
# ERRS=$(go vet ${TARGETS} 2>&1 || true)
# if [ -n "${ERRS}" ]; then
# echo "FAIL"
# echo "${ERRS}"
# echo
# exit 1
# fi
# echo "PASS"
# echo
echo "Success!"