mirror of
https://github.com/containers/skopeo.git
synced 2025-05-04 22:16:43 +00:00
Validating only committed files is not useful in the natural $test_everything_passes; commit; push workflow; the failures will not be caught locally, only by Travis later (and only if PRs are used instead of direct commits to master). So, use the working directory state instead of last commit for validations; and remove misleading comments in checks which already use the working directory state.
34 lines
761 B
Bash
Executable File
34 lines
761 B
Bash
Executable File
#!/bin/bash
|
|
|
|
source "$(dirname "$BASH_SOURCE")/.validate"
|
|
|
|
# We will eventually get to the point where packages should be the complete list
|
|
# of subpackages, vendoring excluded, as given by:
|
|
#
|
|
IFS=$'\n'
|
|
files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/\|^integration' || true) )
|
|
unset IFS
|
|
|
|
errors=()
|
|
for f in "${files[@]}"; do
|
|
failedLint=$(golint "$f")
|
|
if [ "$failedLint" ]; then
|
|
errors+=( "$failedLint" )
|
|
fi
|
|
done
|
|
|
|
if [ ${#errors[@]} -eq 0 ]; then
|
|
echo 'Congratulations! All Go source files have been linted.'
|
|
else
|
|
{
|
|
echo "Errors from golint:"
|
|
for err in "${errors[@]}"; do
|
|
echo "$err"
|
|
done
|
|
echo
|
|
echo 'Please fix the above errors. You can test via "golint" and commit the result.'
|
|
echo
|
|
} >&2
|
|
false
|
|
fi
|