lint.yaml 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. name: Lint Check
  2. on:
  3. push:
  4. branches:
  5. - main
  6. - release/**
  7. pull_request:
  8. branches:
  9. - main
  10. - release/**
  11. permissions: read-all
  12. jobs:
  13. gofmt:
  14. runs-on: ubuntu-latest
  15. timeout-minutes: 5
  16. steps:
  17. - uses: actions/checkout@v3
  18. - name: Setup Go Environment
  19. uses: actions/setup-go@v3
  20. with:
  21. go-version: '1.20.3'
  22. - name: Run gofmt Check
  23. working-directory: ./
  24. run: |
  25. diffs=`gofmt -l .`
  26. if [[ -n $diffs ]]; then
  27. echo "Files are not formatted by gofmt:"
  28. echo $diffs
  29. exit 1
  30. fi
  31. golint:
  32. runs-on: ubuntu-latest
  33. timeout-minutes: 10
  34. steps:
  35. - uses: actions/checkout@v3
  36. - name: Setup Go Environment
  37. uses: actions/setup-go@v3
  38. with:
  39. go-version: '1.20.3'
  40. - name: Download golangci-lint
  41. run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2
  42. - name: Run Golang Linters
  43. working-directory: ./
  44. run: |
  45. PATH=${PATH}:$(go env GOPATH)/bin make lint