gitea源码

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. set -uo pipefail
  3. cd "$(dirname -- "${BASH_SOURCE[0]}")" && cd ..
  4. IGNORE_PATTERNS=(
  5. "is deprecated" # TODO: fix these
  6. )
  7. # lint all go files with 'gopls check' and look for lines starting with the
  8. # current absolute path, indicating a error was found. This is necessary
  9. # because the tool does not set non-zero exit code when errors are found.
  10. # ref: https://github.com/golang/go/issues/67078
  11. ERROR_LINES=$("$GO" run "$GOPLS_PACKAGE" check -severity=warning "$@" 2>/dev/null | grep -E "^$PWD" | grep -vFf <(printf '%s\n' "${IGNORE_PATTERNS[@]}"));
  12. NUM_ERRORS=$(echo -n "$ERROR_LINES" | wc -l)
  13. if [ "$NUM_ERRORS" -eq "0" ]; then
  14. exit 0;
  15. else
  16. echo "$ERROR_LINES"
  17. echo "Found $NUM_ERRORS 'gopls check' errors"
  18. exit 1;
  19. fi