Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
27cc32b8
Commit
27cc32b8
authored
Feb 10, 2017
by
Joe Finney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add verify-gofmt as a Bazel test.
Also, moved --flaky_test_attempts=3 out of .bazelrc since it was annoying.
parent
a6952bc9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
11 deletions
+23
-11
.bazelrc
.bazelrc
+0
-3
Makefile
Makefile
+1
-1
BUILD
hack/BUILD
+11
-0
verify-gofmt.sh
hack/verify-gofmt.sh
+11
-7
No files found.
.bazelrc
View file @
27cc32b8
...
@@ -2,8 +2,5 @@
...
@@ -2,8 +2,5 @@
build --verbose_failures
build --verbose_failures
test --test_output=errors
test --test_output=errors
# Retry tests up to 3 times if they fail.
test --flaky_test_attempts=3
# Include git version info
# Include git version info
build --workspace_status_command hack/print-workspace-status.sh
build --workspace_status_command hack/print-workspace-status.sh
Makefile
View file @
27cc32b8
...
@@ -500,7 +500,7 @@ endef
...
@@ -500,7 +500,7 @@ endef
@echo
"$$BAZEL_TEST_HELP_INFO"
@echo
"$$BAZEL_TEST_HELP_INFO"
else
else
bazel-test
:
bazel-test
:
bazel
test
//cmd/... //pkg/... //federation/... //plugin/... //third_party/... //hack/... //hack:verify-all
bazel
test
--flaky_test_attempts
=
3
//cmd/... //pkg/... //federation/... //plugin/... //third_party/... //hack/... //hack:verify-all
endif
endif
ifeq
($(PRINT_HELP),y)
ifeq
($(PRINT_HELP),y)
...
...
hack/BUILD
View file @
27cc32b8
...
@@ -27,10 +27,21 @@ sh_test(
...
@@ -27,10 +27,21 @@ sh_test(
tags = ["manual"],
tags = ["manual"],
)
)
sh_test(
name = "verify-gofmt",
srcs = ["verify-gofmt.sh"],
data = [
"//:all-srcs",
"@io_bazel_rules_go_toolchain//:toolchain",
],
tags = ["manual"],
)
test_suite(
test_suite(
name = "verify-all",
name = "verify-all",
tags = ["manual"],
tags = ["manual"],
tests = [
tests = [
"verify-boilerplate",
"verify-boilerplate",
"verify-gofmt",
],
],
)
)
hack/verify-gofmt.sh
View file @
27cc32b8
...
@@ -23,10 +23,15 @@ set -o pipefail
...
@@ -23,10 +23,15 @@ set -o pipefail
KUBE_ROOT
=
$(
dirname
"
${
BASH_SOURCE
}
"
)
/..
KUBE_ROOT
=
$(
dirname
"
${
BASH_SOURCE
}
"
)
/..
source
"
${
KUBE_ROOT
}
/hack/lib/init.sh"
source
"
${
KUBE_ROOT
}
/hack/lib/init.sh"
kube::golang::verify_go_version
cd
"
${
KUBE_ROOT
}
"
cd
"
${
KUBE_ROOT
}
"
# Prefer bazel's gofmt.
gofmt
=
"external/io_bazel_rules_go_toolchain/bin/gofmt"
if
[[
!
-x
"
${
gofmt
}
"
]]
;
then
gofmt
=
$(
which gofmt
)
kube::golang::verify_go_version
fi
find_files
()
{
find_files
()
{
find
.
-not
\(
\
find
.
-not
\(
\
\(
\
\(
\
...
@@ -38,14 +43,13 @@ find_files() {
...
@@ -38,14 +43,13 @@ find_files() {
-o
-wholename
'*/third_party/*'
\
-o
-wholename
'*/third_party/*'
\
-o
-wholename
'*/vendor/*'
\
-o
-wholename
'*/vendor/*'
\
-o
-wholename
'./staging'
\
-o
-wholename
'./staging'
\
-o
-wholename
'*/bindata.go'
\
\)
-prune
\
\)
-prune
\
\)
-name
'*.go'
\)
-name
'*.go'
}
}
GOFMT
=
"gofmt -s -w"
diff
=
$(
find_files | xargs
${
gofmt
}
-d
-s
2>&1
)
bad_files
=
$(
find_files | xargs
$GOFMT
-l
)
if
[[
-n
"
${
diff
}
"
]]
;
then
if
[[
-n
"
${
bad_files
}
"
]]
;
then
echo
"
${
diff
}
"
echo
"!!! '
$GOFMT
' needs to be run on the following files: "
echo
"
${
bad_files
}
"
exit
1
exit
1
fi
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment