Clean up scripts/validate-*. Add vet,gofmt,lint tests.

Travis now runs `make validate` as first test.
Make validate includes all validate tests (go vet, gofmt)
This commit is contained in:
Tomas Kral
2016-11-22 13:02:13 +01:00
parent e6b3c2881f
commit 8bb89876cf
8 changed files with 52 additions and 113 deletions
+3 -28
View File
@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Copyright 2016 The Kubernetes Authors All rights reserved.
#
@@ -16,31 +17,5 @@
source "$(dirname "$BASH_SOURCE")/.validate"
IFS=$'\n'
files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' || true) )
unset IFS
errors=()
for f in "${files[@]}"; do
# we use "git show" here to validate that what's committed passes go vet
failedVet=$(go vet "$f")
if [ "$failedVet" ]; then
errors+=( "$failedVet" )
fi
done
if [ ${#errors[@]} -eq 0 ]; then
echo 'Congratulations! All Go source files have been vetted.'
else
{
echo "Errors from go vet:"
for err in "${errors[@]}"; do
echo " - $err"
done
echo
echo 'Please fix the above errors. You can test via "go vet" and commit the result.'
echo
} >&2
false
fi
go vet $PKGS;