mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
hack/verify-golint: enforce cleanup of old packages
This commit is contained in:
parent
d0eb7f88a6
commit
81461f7214
@ -76,6 +76,12 @@ for p in "${all_packages[@]}"; do
|
||||
fi
|
||||
done
|
||||
|
||||
# Check that all linted_packages actually still exist
|
||||
gone=()
|
||||
for p in "${linted_packages[@]}"; do
|
||||
array_contains "$p" "${all_packages[@]}" || gone+=( "$p" )
|
||||
done
|
||||
|
||||
# Check to be sure all the packages that should pass lint are.
|
||||
if [ ${#errors[@]} -eq 0 ]; then
|
||||
echo 'Congratulations! All Go source files have been linted.'
|
||||
@ -94,18 +100,29 @@ fi
|
||||
|
||||
# check to make sure all packages that pass lint are in the linted file.
|
||||
echo
|
||||
if [ ${#linted[@]} -eq 0 ]; then
|
||||
if [ ${#linted[@]} -eq 0 -a ${#gone[@]} -eq 0 ]; then
|
||||
echo 'Success! All packages that should pass lint are listed in the linted file.'
|
||||
else
|
||||
{
|
||||
echo "Some packages passed golint but are not listed in hack/.linted_packages."
|
||||
echo "Please add them in alphabetical order:"
|
||||
echo
|
||||
for p in "${linted[@]}"; do
|
||||
echo " echo $p >> hack/.linted_packages"
|
||||
done
|
||||
echo " LC_ALL=C sort -o hack/.linted_packages hack/.linted_packages"
|
||||
echo
|
||||
if [ ${#gone[@]} -gt 0 ]; then
|
||||
echo "Some packages in hack/.linted_packages do not exist anymore. Please remove them"
|
||||
echo "from hack/.linted_packages:"
|
||||
echo
|
||||
for p in "${gone[@]}"; do
|
||||
echo " $p"
|
||||
done
|
||||
echo
|
||||
fi
|
||||
if [ ${#linted[@]} -gt 0 ]; then
|
||||
echo "Some packages passed golint but are not listed in hack/.linted_packages."
|
||||
echo "Please add them in alphabetical order:"
|
||||
echo
|
||||
for p in "${linted[@]}"; do
|
||||
echo " echo $p >> hack/.linted_packages"
|
||||
done
|
||||
echo " LC_ALL=C sort -o hack/.linted_packages hack/.linted_packages"
|
||||
echo
|
||||
fi
|
||||
echo 'You can test via this script and commit the result.'
|
||||
echo
|
||||
} >&2
|
||||
|
Loading…
Reference in New Issue
Block a user