Run hack/verify-govet.sh as part of verify make target

This commit ensures that:
- go vet will be run as part of the make verify target
- the vet make-rule script won't be run directly, as generated_files won't be run in that case
- that go vet errors show up in the build log with a start time, finish time, and SUCCESS/FAILED message as part of the verify make rule script
This commit is contained in:
Christoph Blecker
2017-06-21 11:10:25 -07:00
parent 3ea93b2753
commit 97783f9093
4 changed files with 12 additions and 14 deletions

View File

@@ -25,7 +25,6 @@ source "${KUBE_ROOT}/hack/lib/util.sh"
EXCLUDED_PATTERNS=(
"verify-all.sh" # this script calls the make rule and would cause a loop
"verify-linkcheck.sh" # runs in separate Jenkins job once per day due to high network usage
"verify-govet.sh" # it has a separate make vet target
"verify-test-owners.sh" # TODO(rmmh): figure out how to avoid endless conflicts
"verify-*-dockerized.sh" # Don't run any scripts that intended to be run dockerized
)

View File

@@ -23,9 +23,16 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
cd "${KUBE_ROOT}"
# If called directly, exit.
if [[ "${CALLED_FROM_MAIN_MAKEFILE:-""}" == "" ]]; then
echo "ERROR: $0 should not be run directly." >&2
echo >&2
echo "Please run this command using \"make vet\""
exit 1
fi
# This is required before we run govet for the results to be correct.
# See https://github.com/golang/go/issues/16086 for details.
make generated_files
go install ./cmd/...
# Use eval to preserve embedded quoted strings.
@@ -46,5 +53,4 @@ if [[ ${#targets[@]} -eq 0 ]]; then
targets=$(go list -e ./... | egrep -v "/(third_party|vendor|staging|clientset_generated)/")
fi
set -x
go vet "${goflags[@]:+${goflags[@]}}" ${targets[@]}

View File

@@ -28,10 +28,4 @@ if [[ "$#" -gt 0 ]]; then
ARGHELP="WHAT='$@'"
fi
echo "NOTE: $0 has been replaced by 'make vet'"
echo
echo "The equivalent of this invocation is: "
echo " make vet ${ARGHELP}"
echo
echo
make --no-print-directory -C "${KUBE_ROOT}" vet WHAT="$@"