diff --git a/hack/verify-govet.sh b/hack/verify-govet.sh index a6dd792bdc94..315c52bbb895 100755 --- a/hack/verify-govet.sh +++ b/hack/verify-govet.sh @@ -5,7 +5,7 @@ set -o pipefail GO_VERSION=($(go version)) -if [[ -z $(echo "${GO_VERSION[2]}" | grep -E 'go1.4') ]]; then +if [[ -z $(echo "${GO_VERSION[2]}" | grep -E 'go1.5') ]]; then echo "Unknown go version '${GO_VERSION}', skipping go vet." exit 0 fi @@ -23,7 +23,55 @@ FAILURE=false test_dirs=$(find_files | cut -d '/' -f 1-2 | sort -u) for test_dir in $test_dirs do - go tool vet -shadow=false $test_dir + go tool vet -all $test_dir + if [ "$?" -ne 0 ] + then + FAILURE=true + fi +done + +# For the sake of slowly white-listing `shadow` checks, we need to keep track of which +# directories we're searching through. The following are all of the directories we care about: +ALL_DIRS='./cmd +./examples +./images +./pkg/api +./pkg/assets +./pkg/auth +./pkg/authorization +./pkg/build +./pkg/client +./pkg/cmd +./pkg/config +./pkg/controller +./pkg/deploy +./pkg/diagnostics +./pkg/dns +./pkg/dockerregistry +./pkg/generate +./pkg/gitserver +./pkg/image +./pkg/ipfailover +./pkg/oauth +./pkg/project +./pkg/route +./pkg/router +./pkg/sdn +./pkg/security +./pkg/service +./pkg/serviceaccounts +./pkg/template +./pkg/user +./pkg/util +./pkg/version +./plugins +./test' + +# Whitelist some directories using a `grep` +SHADOW_TEST_DIRS= +for test_dir in $SHADOW_TEST_DIRS +do + go tool vet -shadow -shadowstrict $test_dir if [ "$?" -ne 0 ] then FAILURE=true