mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-13 13:14:05 +00:00
Add check-file-in-alphabetical-order for cleanup
Both verify-golint.sh and verify-shellcheck.sh have the same logic which checks failure_file in alphabetical order. In addition, we'd like to add another script which requires the same logic. So this add a common function for cleanup.
This commit is contained in:
@@ -20,6 +20,7 @@ set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
source "${KUBE_ROOT}/hack/lib/util.sh"
|
||||
|
||||
kube::golang::verify_go_version
|
||||
|
||||
@@ -49,16 +50,7 @@ array_contains () {
|
||||
|
||||
# Check that the file is in alphabetical order
|
||||
failure_file="${KUBE_ROOT}/hack/.golint_failures"
|
||||
if ! diff -u "${failure_file}" <(LC_ALL=C sort "${failure_file}"); then
|
||||
{
|
||||
echo
|
||||
echo "hack/.golint_failures is not in alphabetical order. Please sort it:"
|
||||
echo
|
||||
echo " LC_ALL=C sort -o hack/.golint_failures hack/.golint_failures"
|
||||
echo
|
||||
} >&2
|
||||
false
|
||||
fi
|
||||
kube::util::check-file-in-alphabetical-order "${failure_file}"
|
||||
|
||||
export IFS=$'\n'
|
||||
# NOTE: when "go list -e ./..." is run within GOPATH, it turns the k8s.io/kubernetes
|
||||
|
Reference in New Issue
Block a user