mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
golangci-lint: add hints for error wrapping
Wrapping errors may or may not be the right thing to do (see https://go.dev/blog/go1.13-errors#whether-to-wrap and the discussion in https://github.com/kubernetes/kubernetes/issues/123234). But developers should at least think about it, so let's emit linter hints for it: the golangci-lint config by default enables it for go-errorlint, just not the linter itself, so we just need to add it for the "hints" config. Direct error comparisons and assertions also get checked. Those are typically something that should be replaced by errors.Is and errors.As, but as the existing code often doesn't do that, let's also treat those as just hints.
This commit is contained in:
parent
5909bd2ddf
commit
8876b68a60
@ -84,6 +84,7 @@ linters:
|
||||
- ginkgolinter
|
||||
- gocritic
|
||||
- govet
|
||||
- errorlint
|
||||
- ineffassign
|
||||
- logcheck
|
||||
- revive
|
||||
|
@ -140,6 +140,9 @@ linters:
|
||||
- ginkgolinter
|
||||
- gocritic
|
||||
- govet
|
||||
{{- if .Hints}}
|
||||
- errorlint
|
||||
{{- end}}
|
||||
- ineffassign
|
||||
- logcheck
|
||||
- revive
|
||||
|
Loading…
Reference in New Issue
Block a user