Use golangci-lint instead of golint

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
Miloslav Trmač
2023-04-05 20:57:55 +02:00
parent c538340e3b
commit d4bd787e5f
3 changed files with 8 additions and 19 deletions

View File

@@ -1,27 +1,15 @@
#!/bin/bash
IFS=$'\n'
files=( $(find . -name '*.go' | grep -v '^\./vendor/' | sort || true) )
unset IFS
errors=$($GOBIN/golangci-lint run --build-tags "${BUILDTAGS}" 2>&1)
errors=()
for f in "${files[@]}"; do
failedLint=$(golint "$f")
if [ "$failedLint" ]; then
errors+=( "$failedLint" )
fi
done
if [ ${#errors[@]} -eq 0 ]; then
if [ -z "$errors" ]; then
echo 'Congratulations! All Go source files have been linted.'
else
{
echo "Errors from golint:"
for err in "${errors[@]}"; do
echo "$err"
done
echo "Errors from golangci-lint:"
echo "$errors"
echo
echo 'Please fix the above errors. You can test via "golint" and commit the result.'
echo 'Please fix the above errors. You can test via "golangci-lint" and commit the result.'
echo
} >&2
exit 1