Skip to content

Commit 97783f9

Browse files
committed
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
1 parent 3ea93b2 commit 97783f9

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

build/root/Makefile

+4-5
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ KUBE_GOLDFLAGS := $(GOLDFLAGS)
5454
KUBE_GOGCFLAGS = $(GOGCFLAGS)
5555

5656
# Extra options for the release or quick-release options:
57-
KUBE_RELEASE_RUN_TESTS := $(KUBE_RELEASE_RUN_TESTS)
57+
KUBE_RELEASE_RUN_TESTS := $(KUBE_RELEASE_RUN_TESTS)
5858
KUBE_FASTBUILD := $(KUBE_FASTBUILD)
5959

6060
# This controls the verbosity of the build. Higher numbers mean more output.
@@ -121,7 +121,6 @@ verify:
121121
else
122122
verify: verify_generated_files
123123
KUBE_VERIFY_GIT_BRANCH=$(BRANCH) hack/make-rules/verify.sh -v
124-
hack/make-rules/vet.sh
125124
endif
126125

127126
define UPDATE_HELP_INFO
@@ -340,8 +339,8 @@ ifeq ($(PRINT_HELP),y)
340339
vet:
341340
@echo "$$VET_HELP_INFO"
342341
else
343-
vet:
344-
hack/make-rules/vet.sh $(WHAT)
342+
vet: generated_files
343+
CALLED_FROM_MAIN_MAKEFILE=1 hack/make-rules/vet.sh $(WHAT)
345344
endif
346345

347346
define RELEASE_HELP_INFO
@@ -361,7 +360,7 @@ endif
361360

362361
define RELEASE_SKIP_TESTS_HELP_INFO
363362
# Build a release, but skip tests
364-
#
363+
#
365364
# Args:
366365
# KUBE_RELEASE_RUN_TESTS: Whether to run tests. Set to 'y' to run tests anyways.
367366
# KUBE_FASTBUILD: Whether to cross-compile for other architectures. Set to 'true' to do so.

hack/make-rules/verify.sh

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

hack/make-rules/vet.sh

+8-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,16 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
2323

2424
cd "${KUBE_ROOT}"
2525

26+
# If called directly, exit.
27+
if [[ "${CALLED_FROM_MAIN_MAKEFILE:-""}" == "" ]]; then
28+
echo "ERROR: $0 should not be run directly." >&2
29+
echo >&2
30+
echo "Please run this command using \"make vet\""
31+
exit 1
32+
fi
33+
2634
# This is required before we run govet for the results to be correct.
2735
# See https://github.com/golang/go/issues/16086 for details.
28-
make generated_files
2936
go install ./cmd/...
3037

3138
# Use eval to preserve embedded quoted strings.
@@ -46,5 +53,4 @@ if [[ ${#targets[@]} -eq 0 ]]; then
4653
targets=$(go list -e ./... | egrep -v "/(third_party|vendor|staging|clientset_generated)/")
4754
fi
4855

49-
set -x
5056
go vet "${goflags[@]:+${goflags[@]}}" ${targets[@]}

hack/verify-govet.sh

-6
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,4 @@ if [[ "$#" -gt 0 ]]; then
2828
ARGHELP="WHAT='$@'"
2929
fi
3030

31-
echo "NOTE: $0 has been replaced by 'make vet'"
32-
echo
33-
echo "The equivalent of this invocation is: "
34-
echo " make vet ${ARGHELP}"
35-
echo
36-
echo
3731
make --no-print-directory -C "${KUBE_ROOT}" vet WHAT="$@"

0 commit comments

Comments
 (0)