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
e2b74ad9
Unverified
Commit
e2b74ad9
authored
Feb 22, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Feb 22, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #73864 from oomichi/cleanup-array_contains
Use kube::util::array_contains() in hack
parents
95856e30
4a91b593
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
30 deletions
+4
-30
verify-golint.sh
hack/verify-golint.sh
+2
-14
verify-shellcheck.sh
hack/verify-shellcheck.sh
+2
-16
No files found.
hack/verify-golint.sh
View file @
e2b74ad9
...
@@ -36,18 +36,6 @@ go install k8s.io/kubernetes/vendor/golang.org/x/lint/golint
...
@@ -36,18 +36,6 @@ go install k8s.io/kubernetes/vendor/golang.org/x/lint/golint
cd
"
${
KUBE_ROOT
}
"
cd
"
${
KUBE_ROOT
}
"
array_contains
()
{
local
seeking
=
$1
;
shift
# shift will iterate through the array
local
in
=
1
# in holds the exit status for the function
for
element
;
do
if
[[
"
$element
"
==
"
$seeking
"
]]
;
then
in
=
0
# set in to 0 since we found it
break
fi
done
return
$in
}
# Check that the file is in alphabetical order
# Check that the file is in alphabetical order
failure_file
=
"
${
KUBE_ROOT
}
/hack/.golint_failures"
failure_file
=
"
${
KUBE_ROOT
}
/hack/.golint_failures"
kube::util::check-file-in-alphabetical-order
"
${
failure_file
}
"
kube::util::check-file-in-alphabetical-order
"
${
failure_file
}
"
...
@@ -76,7 +64,7 @@ for p in "${all_packages[@]}"; do
...
@@ -76,7 +64,7 @@ for p in "${all_packages[@]}"; do
# Ref: https://github.com/kubernetes/kubernetes/pull/67675
# Ref: https://github.com/kubernetes/kubernetes/pull/67675
# Ref: https://github.com/golang/lint/issues/68
# Ref: https://github.com/golang/lint/issues/68
failedLint
=
$(
ls
"
$p
"
/
*
.go | egrep
-v
"(zz_generated.*.go|generated.pb.go|generated.proto|types_swagger_doc_generated.go)"
| xargs
-L1
golint 2>/dev/null
)
failedLint
=
$(
ls
"
$p
"
/
*
.go | egrep
-v
"(zz_generated.*.go|generated.pb.go|generated.proto|types_swagger_doc_generated.go)"
| xargs
-L1
golint 2>/dev/null
)
array_contains
"
$p
"
"
${
failing_packages
[@]
}
"
&&
in_failing
=
$?
||
in_failing
=
$?
kube::util::
array_contains
"
$p
"
"
${
failing_packages
[@]
}
"
&&
in_failing
=
$?
||
in_failing
=
$?
if
[[
-n
"
${
failedLint
}
"
]]
&&
[[
"
${
in_failing
}
"
-ne
"0"
]]
;
then
if
[[
-n
"
${
failedLint
}
"
]]
&&
[[
"
${
in_failing
}
"
-ne
"0"
]]
;
then
errors+
=(
"
${
failedLint
}
"
)
errors+
=(
"
${
failedLint
}
"
)
fi
fi
...
@@ -88,7 +76,7 @@ done
...
@@ -88,7 +76,7 @@ done
# Check that all failing_packages actually still exist
# Check that all failing_packages actually still exist
gone
=()
gone
=()
for
p
in
"
${
failing_packages
[@]
}
"
;
do
for
p
in
"
${
failing_packages
[@]
}
"
;
do
array_contains
"
$p
"
"
${
all_packages
[@]
}
"
||
gone+
=(
"
$p
"
)
kube::util::
array_contains
"
$p
"
"
${
all_packages
[@]
}
"
||
gone+
=(
"
$p
"
)
done
done
# Check to be sure all the packages that should pass lint are.
# Check to be sure all the packages that should pass lint are.
...
...
hack/verify-shellcheck.sh
View file @
e2b74ad9
...
@@ -88,20 +88,6 @@ while IFS=$'\n' read -r script;
...
@@ -88,20 +88,6 @@ while IFS=$'\n' read -r script;
do
failing_files+
=(
"
$script
"
)
;
do
failing_files+
=(
"
$script
"
)
;
done
< <
(
cat
"
${
failure_file
}
"
)
done
< <
(
cat
"
${
failure_file
}
"
)
# TODO(bentheelder): we should probably move this and the copy in verify-golint.sh
# to one of the bash libs
array_contains
()
{
local
seeking
=
$1
;
shift
# shift will iterate through the array
local
in
=
1
# in holds the exit status for the function
for
element
;
do
if
[[
"
$element
"
==
"
$seeking
"
]]
;
then
in
=
0
# set in to 0 since we found it
break
fi
done
return
$in
}
# detect if the host machine has the required shellcheck version installed
# detect if the host machine has the required shellcheck version installed
# if so, we will use that instead.
# if so, we will use that instead.
HAVE_SHELLCHECK
=
false
HAVE_SHELLCHECK
=
false
...
@@ -143,7 +129,7 @@ for f in "${all_shell_scripts[@]}"; do
...
@@ -143,7 +129,7 @@ for f in "${all_shell_scripts[@]}"; do
shellcheck
--exclude
=
"
${
SHELLCHECK_DISABLED
}
"
"
${
f
}
"
)
shellcheck
--exclude
=
"
${
SHELLCHECK_DISABLED
}
"
"
${
f
}
"
)
fi
fi
set
-o
errexit
set
-o
errexit
array_contains
"
${
f
}
"
"
${
failing_files
[@]
}
"
&&
in_failing
=
$?
||
in_failing
=
$?
kube::util::
array_contains
"
${
f
}
"
"
${
failing_files
[@]
}
"
&&
in_failing
=
$?
||
in_failing
=
$?
if
[[
-n
"
${
failedLint
}
"
]]
&&
[[
"
${
in_failing
}
"
-ne
"0"
]]
;
then
if
[[
-n
"
${
failedLint
}
"
]]
&&
[[
"
${
in_failing
}
"
-ne
"0"
]]
;
then
errors+
=(
"
${
failedLint
}
"
)
errors+
=(
"
${
failedLint
}
"
)
fi
fi
...
@@ -185,7 +171,7 @@ fi
...
@@ -185,7 +171,7 @@ fi
# Check that all failing_packages actually still exist
# Check that all failing_packages actually still exist
gone
=()
gone
=()
for
f
in
"
${
failing_files
[@]
}
"
;
do
for
f
in
"
${
failing_files
[@]
}
"
;
do
array_contains
"
$f
"
"
${
all_shell_scripts
[@]
}
"
||
gone+
=(
"
$f
"
)
kube::util::
array_contains
"
$f
"
"
${
all_shell_scripts
[@]
}
"
||
gone+
=(
"
$f
"
)
done
done
if
[[
${#
gone
[@]
}
-gt
0
]]
;
then
if
[[
${#
gone
[@]
}
-gt
0
]]
;
then
...
...
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