mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +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
|
fi
|
||||||
done
|
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.
|
# Check to be sure all the packages that should pass lint are.
|
||||||
if [ ${#errors[@]} -eq 0 ]; then
|
if [ ${#errors[@]} -eq 0 ]; then
|
||||||
echo 'Congratulations! All Go source files have been linted.'
|
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.
|
# check to make sure all packages that pass lint are in the linted file.
|
||||||
echo
|
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.'
|
echo 'Success! All packages that should pass lint are listed in the linted file.'
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo "Some packages passed golint but are not listed in hack/.linted_packages."
|
if [ ${#gone[@]} -gt 0 ]; then
|
||||||
echo "Please add them in alphabetical order:"
|
echo "Some packages in hack/.linted_packages do not exist anymore. Please remove them"
|
||||||
echo
|
echo "from hack/.linted_packages:"
|
||||||
for p in "${linted[@]}"; do
|
echo
|
||||||
echo " echo $p >> hack/.linted_packages"
|
for p in "${gone[@]}"; do
|
||||||
done
|
echo " $p"
|
||||||
echo " LC_ALL=C sort -o hack/.linted_packages hack/.linted_packages"
|
done
|
||||||
echo
|
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 'You can test via this script and commit the result.'
|
||||||
echo
|
echo
|
||||||
} >&2
|
} >&2
|
||||||
|
Loading…
Reference in New Issue
Block a user