Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 25 additions & 27 deletions hack/verify-govet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,39 @@ mkdir -p _output/govet
os::build::setup_env

vetexceptions=(
"pkg/auth/ldaputil/client.go:69: assignment copies lock value to c: crypto/tls.Config contains sync.Once contains sync.Mutex"
"pkg/auth/ldaputil/client.go:69: assignment copies lock value to c: crypto/tls.Config contains sync.Once contains sync.Mutex"
)
function is_vetexception()
{
text=$1
echo "checking ${text}"
for ve in "${vetexceptions[@]}"
do
if [[ ve == ${text} ]]
then
echo "returning true"
return 0
fi
done
return 1

function is_vetexception() {
text=$1
echo "checking ${text}"
for ve in "${vetexceptions[@]}"; do
if [[ "${ve}" = "${text}" ]]; then
echo "returning true"
return 0
fi
done
return 1
}

FAILURE=false
test_dirs=$(find_files | cut -d '/' -f 1-2 | sort -u)
for test_dir in $test_dirs
do
result=$(go tool vet -shadow=false $test_dir)
if [ "$?" -ne 0 ] && [ ! is_vetexception "${result}" ]
then
FAILURE=true
fi
for test_dir in $test_dirs; do
if ! result="$( go tool vet -shadow=false "${test_dir}" )"; then
while read -r line; do
if ! is_vetexception "${line}"; then
FAILURE=true
fi
done <<<${result}
fi
done

# We don't want to exit on the first failure of go vet, so just keep track of
# whether a failure occurred or not.
if $FAILURE
then
echo "FAILURE: go vet failed!"
exit 1
if $FAILURE; then
echo "FAILURE: go vet failed!"
exit 1
else
echo "SUCCESS: go vet succeded!"
exit 0
echo "SUCCESS: go vet succeded!"
exit 0
fi