Skip to content

Instantly share code, notes, and snippets.

@stevekuznetsov
Created October 15, 2015 14:11
Show Gist options
  • Save stevekuznetsov/f3b3e41587ad9428eb41 to your computer and use it in GitHub Desktop.
Save stevekuznetsov/f3b3e41587ad9428eb41 to your computer and use it in GitHub Desktop.
hack-verify-govet.sh
#!/bin/bash
set -o nounset
set -o pipefail
function exit_func() {
echo "exiting from $?"
}
trap exit_func EXIT
GO_VERSION=($(go version))
OS_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${OS_ROOT}/hack/common.sh"
source "${OS_ROOT}/hack/util.sh"
cd "${OS_ROOT}"
mkdir -p _output/govet
os::build::setup_env
set +x
FAILURE=false
test_dirs=$(find_files | cut -d '/' -f 1-2 | sort -u)
for test_dir in $test_dirs
do
bash -c "GOPATH=$GOPATH:/root/go/src/github.com/openshift/origin go tool vet -v $test_dir"
echo "testing ${test_dir}, got $?"
if [ "$?" -ne 0 ]
then
FAILURE=true
fi
done
# We don't want to exit on the first failure of go vet, so just keep track of
# whether a failure occured or not.
if $FAILURE
then
echo "FAILURE: go vet failed!"
exit 1
else
echo "SUCCESS: go vet succeded!"
exit 0
fi
@stevekuznetsov
Copy link
Author

output:

$ hack/verify-govet.sh 
vet: assets/assets.go:4:4: could not import github.com/jteeuwen/go-bindata (can't find import: github.com/jteeuwen/go-bindata)
Checking file assets/assets.go
Checking file assets/doc.go
exiting from 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment