mirror of
https://github.com/go-gitea/gitea
synced 2025-12-07 05:18:29 +00:00
Replace lint-go-gopls with additional govet linters (#36028)
Many (but not all) analyzers ran by `gopls check` are available in `golangci-lint` as part of default-disabled `govet` linters, so I think it's best we remove this manual linting step and let `golangci-lint` handle it. I hand-picked two available linters that were previously linted using gopls and this list is not exhaustive. This will reduce CI time by about 3 minutes.
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -uo pipefail
|
||||
|
||||
cd "$(dirname -- "${BASH_SOURCE[0]}")" && cd ..
|
||||
|
||||
IGNORE_PATTERNS=(
|
||||
"is deprecated" # TODO: fix these
|
||||
)
|
||||
|
||||
# lint all go files with 'gopls check' and look for lines starting with the
|
||||
# current absolute path, indicating a error was found. This is necessary
|
||||
# because the tool does not set non-zero exit code when errors are found.
|
||||
# ref: https://github.com/golang/go/issues/67078
|
||||
ERROR_LINES=$("$GO" run "$GOPLS_PACKAGE" check -severity=warning "$@" 2>/dev/null | grep -E "^$PWD" | grep -vFf <(printf '%s\n' "${IGNORE_PATTERNS[@]}"));
|
||||
NUM_ERRORS=$(echo -n "$ERROR_LINES" | wc -l)
|
||||
|
||||
if [ "$NUM_ERRORS" -eq "0" ]; then
|
||||
exit 0;
|
||||
else
|
||||
echo "$ERROR_LINES"
|
||||
echo "Found $NUM_ERRORS 'gopls check' errors"
|
||||
exit 1;
|
||||
fi
|
||||
Reference in New Issue
Block a user