Skip to content

Commit

Permalink
created structure for whitelisting directories for govet shadow testing
Browse files Browse the repository at this point in the history
  • Loading branch information
stevekuznetsov committed Dec 28, 2015
1 parent 99c6de7 commit 04aaceb
Showing 1 changed file with 50 additions and 2 deletions.
52 changes: 50 additions & 2 deletions hack/verify-govet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 04aaceb

Please sign in to comment.