Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ jobs:
- name: Run checks/linters
run: |
# use GITHUB_TOKEN because only it has access to GitHub Checks API
bin/golangci-lint run --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -reporter=github-pr-review -filter-mode=added -fail-level=error
bin/golangci-lint run --output.text.path=stdout --output.text.print-issued-lines=false --output.text.colors=false | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -reporter=github-pr-review -filter-mode=added -fail-level=error
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not to switch to unified approach that we use:

     -  name: Run code linters
        uses: reviewdog/action-golangci-lint@c76cceaaab89abe74e649d2e34c6c9adc26662d2 # v2.10.0
        with:
          github_token: ${{ secrets.ROBOT_TOKEN || secrets.GITHUB_TOKEN }}
          go_version_file: ${{ github.workspace }}/go.mod
          reporter: github-pr-review
          fail_level: error
          cache: false
          golangci_lint_flags: "-c=.golangci.yml"
          golangci_lint_version: v2.12.2 # Version should match specified in Makefile


# run it like that until some of those issues/PRs are resolved:
# * https://github.com/quasilyte/go-consistent/issues/33
Expand Down
117 changes: 72 additions & 45 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,77 @@
---
# Almost all linters; some of them are optional.

linters-settings:
depguard:
rules:
main:
deny:
- pkg: errors
desc: Use "github.com/pkg/errors" instead
- pkg: github.com/gogo/protobuf/proto
desc: Use "github.com/golang/protobuf/proto" instead
- pkg: gopkg.in/yaml.v2
desc: Use "gopkg.in/yaml.v3" instead

goimports:
local-prefixes: github.com/percona/platform

unused:
check-exported: false

unparam:
check-exported: true

version: "2"
linters:
enable-all: true
default: all
disable:
- exhaustruct # verbose style
- funlen # annoying
- gci # works poorly
- err113 # we use pkg/errors for stack traces
- ireturn # incompatible with the codebase
- lll # gRPC types are long
- maintidx # disable for compatability
- nlreturn # conflicts with formatter
- nonamedreturns # named returns improves readability
- tagliatelle # json syntax used in different packages varies
- varnamelen # doesn't match the go codestyle
- wrapcheck # forces to wrap errors everywhere
- wsl # too annoying
- exportloopref #deprecated

issues:
exclude-use-default: false
exclude-rules:
- path: _test\.go
linters:
- funlen # tests may be long
- testpackage # senseless
- unused # very annoying false positive: https://github.com/golangci/golangci-lint/issues/791
- err113 # we use pkg/errors for stack traces
- exhaustruct # verbose style
- funlen # annoying
- ireturn # incompatible with the codebase
- lll # gRPC types are long
- maintidx # disable for compatability
- nlreturn # conflicts with formatter
- noinlineerr # TODO: enable post-migration
- nonamedreturns # named returns improves readability
- tagliatelle # json syntax used in different packages varies
- varnamelen # doesn't match the go codestyle
- wrapcheck # forces to wrap errors everywhere
- wsl # too annoying
- wsl_v5 # too annoying
- embeddedstructfieldcheck # TODO: enable post-migration
- iotamixing # TODO: enable post-migration
- modernize # TODO: enable post-migration
settings:
depguard:
rules:
main:
deny:
- pkg: errors
desc: Use "github.com/pkg/errors" instead
- pkg: github.com/gogo/protobuf/proto
desc: Use "github.com/golang/protobuf/proto" instead
- pkg: gopkg.in/yaml.v2
desc: Use "gopkg.in/yaml.v3" instead
unparam:
check-exported: true
exclusions:
generated: lax
rules:
- linters:
- funlen # tests may be long
- testpackage # senseless
- unused # very annoying false positive: https://github.com/golangci/golangci-lint/issues/791
path: _test\.go
# TODO: address findings newly surfaced by golangci-lint v2 and remove these exclusions.
- path: pkg/email/email\.go
linters: [staticcheck]
text: "SA1019.*aws-sdk-go"
- path: pkg/fsp/sorting\.go
linters: [staticcheck]
text: "QF1003"
- path: pkg/grpcutils/dial\.go
linters: [nolintlint]
- path: pkg/servers/logging_interceptor\.go
linters: [nolintlint]
- path: pkg/servers/grpc\.go
linters: [noctx, prealloc]
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- gofumpt
- goimports
settings:
goimports:
local-prefixes:
- github.com/percona/platform
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
Loading