File tree Expand file tree Collapse file tree 4 files changed +23
-11
lines changed Expand file tree Collapse file tree 4 files changed +23
-11
lines changed Original file line number Diff line number Diff line change 2
2
build --verbose_failures
3
3
test --test_output=errors
4
4
5
- # Retry tests up to 3 times if they fail.
6
- test --flaky_test_attempts=3
7
-
8
5
# Include git version info
9
6
build --workspace_status_command hack/print-workspace-status.sh
Original file line number Diff line number Diff line change @@ -500,7 +500,7 @@ endef
500
500
@echo "$$BAZEL_TEST_HELP_INFO"
501
501
else
502
502
bazel-test :
503
- bazel test //cmd/... //pkg/... //federation/... //plugin/... //third_party/... //hack/... //hack:verify-all
503
+ bazel test --flaky_test_attempts=3 //cmd/... //pkg/... //federation/... //plugin/... //third_party/... //hack/... //hack:verify-all
504
504
endif
505
505
506
506
ifeq ($(PRINT_HELP ) ,y)
Original file line number Diff line number Diff line change @@ -27,10 +27,21 @@ sh_test(
27
27
tags = ["manual" ],
28
28
)
29
29
30
+ sh_test (
31
+ name = "verify-gofmt" ,
32
+ srcs = ["verify-gofmt.sh" ],
33
+ data = [
34
+ "//:all-srcs" ,
35
+ "@io_bazel_rules_go_toolchain//:toolchain" ,
36
+ ],
37
+ tags = ["manual" ],
38
+ )
39
+
30
40
test_suite (
31
41
name = "verify-all" ,
32
42
tags = ["manual" ],
33
43
tests = [
34
44
"verify-boilerplate" ,
45
+ "verify-gofmt" ,
35
46
],
36
47
)
Original file line number Diff line number Diff line change @@ -23,10 +23,15 @@ set -o pipefail
23
23
KUBE_ROOT=$( dirname " ${BASH_SOURCE} " ) /..
24
24
source " ${KUBE_ROOT} /hack/lib/init.sh"
25
25
26
- kube::golang::verify_go_version
27
-
28
26
cd " ${KUBE_ROOT} "
29
27
28
+ # Prefer bazel's gofmt.
29
+ gofmt=" external/io_bazel_rules_go_toolchain/bin/gofmt"
30
+ if [[ ! -x " ${gofmt} " ]]; then
31
+ gofmt=$( which gofmt)
32
+ kube::golang::verify_go_version
33
+ fi
34
+
30
35
find_files () {
31
36
find . -not \( \
32
37
\( \
@@ -38,14 +43,13 @@ find_files() {
38
43
-o -wholename ' */third_party/*' \
39
44
-o -wholename ' */vendor/*' \
40
45
-o -wholename ' ./staging' \
46
+ -o -wholename ' */bindata.go' \
41
47
\) -prune \
42
48
\) -name ' *.go'
43
49
}
44
50
45
- GOFMT=" gofmt -s -w"
46
- bad_files=$( find_files | xargs $GOFMT -l)
47
- if [[ -n " ${bad_files} " ]]; then
48
- echo " !!! '$GOFMT ' needs to be run on the following files: "
49
- echo " ${bad_files} "
51
+ diff=$( find_files | xargs ${gofmt} -d -s 2>&1 )
52
+ if [[ -n " ${diff} " ]]; then
53
+ echo " ${diff} "
50
54
exit 1
51
55
fi
You can’t perform that action at this time.
0 commit comments