You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.1 KiB

  1. #!/bin/sh
  2. echo ">>> golint"
  3. for dir in $(go list ./... | grep -v /vendor/)
  4. do
  5. golint "${dir}"
  6. done
  7. echo "<<< golint"
  8. echo
  9. echo ">>> go vet"
  10. go vet $(go list ./... | grep -v /vendor/)
  11. echo "<<< go vet"
  12. echo
  13. echo ">>> gosimple"
  14. gosimple $(go list ./... | grep -v /vendor/)
  15. echo "<<< gosimple"
  16. echo
  17. echo ">>> staticcheck"
  18. staticcheck $(go list ./... | grep -v /vendor/)
  19. echo "<<< staticcheck"
  20. echo
  21. echo ">>> unused"
  22. unused $(go list ./... | grep -v /vendor/)
  23. echo "<<< unused"
  24. echo
  25. echo ">>> gas"
  26. gas $(find . -name "*.go" | grep -v /vendor/ | grep -v '_test.go$')
  27. echo "<<< gas"
  28. echo
  29. # Check for gofmt problems and report if any.
  30. gofiles=$(git diff --cached --name-only --diff-filter=ACM | grep '.go$' | grep -v /vendor/)
  31. [ -z "$gofiles" ] && echo "EXIT $vetres" && exit $vetres
  32. if [ -n "$gofiles" ]; then
  33. unformatted=$(gofmt -l $gofiles)
  34. if [ -n "$unformatted" ]; then
  35. # Some files are not gofmt'd.
  36. echo >&2 "Go files must be formatted with gofmt. Please run:"
  37. for fn in $unformatted; do
  38. echo >&2 " gofmt -w $PWD/$fn"
  39. done
  40. fi
  41. fi
  42. echo