diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index 85d3f0c5..ec41a739 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -1,6 +1,6 @@ --- name: linter -on: # yamllint disable-line rule:truthy +on: # yamllint disable-line rule:truthy push: branches: - "*" @@ -16,15 +16,15 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.22' + go-version: "1.22" cache: false - name: golangci-lint - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v8 with: # Require: The version of golangci-lint to use. # When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version. # When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit. - version: v1.54 + version: v2.3.1 # Optional: working directory, useful for monorepos # working-directory: somedir @@ -58,4 +58,4 @@ jobs: - uses: actions/checkout@v4 - name: Lint YAML files - run: yamllint . # YAML lint is already installed in ubuntu-latest + run: yamllint . # YAML lint is already installed in ubuntu-latest diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index cceefe37..4e5ddb5f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,6 +1,6 @@ --- name: unittest -on: # yamllint disable-line rule:truthy +on: # yamllint disable-line rule:truthy push: branches: - "*" @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.22' + go-version: "1.22" - name: Install dependencies run: | go get . @@ -38,7 +38,7 @@ jobs: hide_complexity: true indicators: true output: both - thresholds: '60 80' + thresholds: "60 80" - uses: jwalton/gh-find-current-pr@v1 id: finder - name: Add Coverage PR Comment @@ -102,8 +102,8 @@ jobs: checkcov: permissions: - security-events: write # for github/codeql-action/upload-sarif to upload SARIF results - actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status + security-events: write # for github/codeql-action/upload-sarif to upload SARIF results + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status runs-on: ubuntu-latest steps: diff --git a/.golangci.yml b/.golangci.yml index ceaf158e..a55d1ca1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,26 +1,10 @@ ---- +version: "2" run: concurrency: 4 - deadline: 2m issues-exit-code: 1 tests: true - -output: - formats: colored-line-number - print-issued-lines: true - print-linter-name: true - linters: - enable-all: false - disable-all: false enable: - - errcheck - - gosimple - - govet - - ineffassign - - staticcheck - - typecheck - - unused - asciicheck - bodyclose - dogsled @@ -33,9 +17,6 @@ linters: - gocritic - gocyclo - godox - - gofmt - - gofumpt - - goimports - gomodguard - goprintffuncname - gosec @@ -53,7 +34,7 @@ linters: - revive - rowserrcheck - sqlclosecheck - - stylecheck + - staticcheck - testpackage - thelper - tparallel @@ -62,30 +43,35 @@ linters: - wastedassign - whitespace - wrapcheck - - wsl - -linters-settings: - gocyclo: - min-complexity: 35 - - revive: + - wsl_v5 + settings: + gocyclo: + min-complexity: 35 + lll: + line-length: 120 + revive: + rules: + - name: exported + disabled: true + exclusions: + generated: lax rules: - - name: exported - disabled: true - - lll: - line-length: 120 - -issues: - exclude-use-default: false - max-per-linter: 1024 - max-same: 1024 - - exclude-rules: - # Exclude some linters from running on test files - - path: _test\.go - linters: - # bodyclose reports some false-positives when using a test request recorder - - bodyclose - # It's overkill to use `NewRequestWithContext` in tests - - noctx + - linters: + - bodyclose + - noctx + path: _test\.go + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gofmt + - gofumpt + - goimports + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$