Merge pull request #73335 from oomichi/cleanup-hack

Add check-file-in-alphabetical-order for cleanup
This commit is contained in:
Kubernetes Prow Robot
2019-02-07 18:24:41 -08:00
committed by GitHub
3 changed files with 21 additions and 20 deletions

View File

@@ -775,6 +775,23 @@ function kube::util::ensure-gnu-sed {
fi
}
# kube::util::check-file-in-alphabetical-order <file>
# Check that the file is in alphabetical order
#
function kube::util::check-file-in-alphabetical-order {
local failure_file="$1"
if ! diff -u "${failure_file}" <(LC_ALL=C sort "${failure_file}"); then
{
echo
echo "${failure_file} is not in alphabetical order. Please sort it:"
echo
echo " LC_ALL=C sort -o ${failure_file} ${failure_file}"
echo
} >&2
false
fi
}
# Some useful colors.
if [[ -z "${color_start-}" ]]; then
declare -r color_start="\033["