-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy path.golangci.yml
More file actions
84 lines (77 loc) · 2.51 KB
/
.golangci.yml
File metadata and controls
84 lines (77 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
version: "2"
linters:
default: none
enable:
# default rules
- errcheck
- govet
- ineffassign
- staticcheck
- unused
# other rules
- asasalint
- asciicheck
- bidichk
- depguard
- durationcheck
- forbidigo
- gocritic
- gocheckcompilerdirectives
- gosec
- makezero
- nilerr
- nolintlint
- reassign
- sqlclosecheck
- unconvert
settings:
nolintlint:
require-explanation: true
require-specific: true
staticcheck:
checks:
- "all"
- "-ST*" # stylecheck: not previously enabled (merged into staticcheck in v2)
- "-QF*" # quickfix suggestions: not previously enabled (merged into staticcheck in v2)
gosec:
excludes:
- G101 # false positives on non-credential string constants
- G602 # false positives on range loops and safe slice access
- G706 # false positives on logging config/environment values
forbidigo:
forbid:
- pattern: "^(fmt\\.Print(|f|ln)|print|println)$"
- pattern: "^(fmt\\.Fprint(|f|ln)|print|println)$"
- pattern: '^zap\.Error$'
- pattern: '^grpc\.(Header|Trailer)$' # easy to misuse and create a data race
gocritic:
disabled-checks:
- ifElseChain # style
- singleCaseSwitch # style & it's actually not a bad idea to use single case switch in some cases
- assignOp # style
- commentFormatting # style
depguard:
rules:
# Name of a rule.
main:
# Packages that are not allowed where the value is a suggestion.
deny:
- pkg: "go.uber.org/zap"
desc: do not use Uber zap directly, use the fplog package instead
- pkg: "github.com/pkg/errors"
desc: Should be replaced by standard lib errors package
exclusions:
presets:
- std-error-handling # errcheck: unchecked Close/Remove/print calls
- common-false-positives # gosec: G103, G204, G304 false positives
- legacy # gosec: G104, G301, G302, G307
rules:
# G118 (cancel fn not called / goroutine context misuse) was added in golangci-lint v2.11.
# These two files have intentional G118 suppression that older local versions see as unused.
- linters: [nolintlint]
text: "unused for linter \"gosec\""
path: "internal/cmdconfig/cmd_hooks\\.go|internal/db_client/db_client_execute\\.go"
paths:
- "tests/acceptance"
run:
timeout: 5m