Skip to content

Commit beca6c7

Browse files
author
s-ito-ts
committed
fix shellcheck failures in /hack/verify-[a-g]*.sh.
1 parent 9f1b04f commit beca6c7

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

hack/.shellcheck_failures

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
./hack/pin-dependency.sh
3030
./hack/test-integration.sh
3131
./hack/update-vendor.sh
32-
./hack/verify-golint.sh
3332
./hack/verify-test-featuregates.sh
3433
./test/cmd/apply.sh
3534
./test/cmd/apps.sh

hack/verify-golint.sh

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ set -o errexit
1818
set -o nounset
1919
set -o pipefail
2020

21-
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
21+
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
2222
source "${KUBE_ROOT}/hack/lib/init.sh"
2323
source "${KUBE_ROOT}/hack/lib/util.sh"
2424

@@ -44,12 +44,10 @@ export IFS=$'\n'
4444
# NOTE: when "go list -e ./..." is run within GOPATH, it turns the k8s.io/kubernetes
4545
# as the prefix, however if we run it outside it returns the full path of the file
4646
# with a leading underscore. We'll need to support both scenarios for all_packages.
47-
all_packages=(
48-
$(go list -e ./... | egrep -v "/(third_party|vendor|staging/src/k8s.io/client-go/pkg|generated|clientset_generated)" | sed -e 's|^k8s.io/kubernetes/||' -e "s|^_\(${KUBE_ROOT}/\)\{0,1\}||")
49-
)
50-
failing_packages=(
51-
$(cat $failure_file)
52-
)
47+
all_packages=()
48+
while IFS='' read -r line; do all_packages+=("$line"); done < <(go list -e ./... | grep -vE "/(third_party|vendor|staging/src/k8s.io/client-go/pkg|generated|clientset_generated)" | sed -e 's|^k8s.io/kubernetes/||' -e "s|^_\(${KUBE_ROOT}/\)\{0,1\}||")
49+
failing_packages=()
50+
while IFS='' read -r line; do failing_packages+=("$line"); done < <(cat "$failure_file")
5351
unset IFS
5452
errors=()
5553
not_failing=()
@@ -63,13 +61,13 @@ for p in "${all_packages[@]}"; do
6361
# completely.
6462
# Ref: https://github.com/kubernetes/kubernetes/pull/67675
6563
# Ref: https://github.com/golang/lint/issues/68
66-
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)
64+
failedLint=$(find "$p"/*.go | grep -vE "(zz_generated.*.go|generated.pb.go|generated.proto|types_swagger_doc_generated.go)" | xargs -L1 golint 2>/dev/null)
6765
kube::util::array_contains "$p" "${failing_packages[@]}" && in_failing=$? || in_failing=$?
6866
if [[ -n "${failedLint}" ]] && [[ "${in_failing}" -ne "0" ]]; then
6967
errors+=( "${failedLint}" )
7068
fi
7169
if [[ -z "${failedLint}" ]] && [[ "${in_failing}" -eq "0" ]]; then
72-
not_failing+=( $p )
70+
not_failing+=( "$p" )
7371
fi
7472
done
7573

0 commit comments

Comments
 (0)