-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.golangci.yml
More file actions
158 lines (129 loc) · 3.43 KB
/
Copy path.golangci.yml
File metadata and controls
158 lines (129 loc) · 3.43 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
version: "2"
run:
tests: true
# Linters & linter-settings inspired by https://olegk.dev/go-linters-configuration-the-right-version
linters:
enable:
# Check for passing []any as any in variadic func(...any).
- asasalint
# Checks for dangerous unicode character sequences.
- bidichk
# Check that HTTP response bodies are closed
- bodyclose
# Check whether the function uses a non-inherited context.
- contextcheck
# Detect when loop variables are copied.
- copyloopvar
# Check for two durations multiplied together.
- durationcheck
# Forces to not skip error check.
- errcheck
# Checks `Err-` prefix for var and `-Error` suffix for error type.
- errname
# Suggests to use `%w` for error-wrapping.
- errorlint
# TODO - enable
# - gocritic
# Handle replace, retract, exclude directives in go.mod
- gomoddirectives
# Detects when assignments to existing variables are unused
- ineffassign
# Check for misspellings
- misspell
# Finds naked/bare returns
- nakedret
# Both require a bit more explicit returns.
- nilerr
- nilnil
# Finds sending HTTP request without context.Context.
# TODO - enable
# - noctx
# Forces comment why another check is disabled.
# Better not to have //nolint: at all ;)
- nolintlint
# Finds shadowing of Go's predeclared identifiers.
# I hear a lot of complaints from junior developers.
# But after some time they find it very useful.
- predeclared
# Lint your Prometheus metrics name.
- promlinter
# Checks that package variables are not reassigned.
# Super rare case but can catch bad things (like `io.EOF = nil`)
- reassign
# Somewhat similar to `bodyclose` but for `database/sql` package.
# TODO - enable
# - rowserrcheck
- sqlclosecheck
# Go's go-to static checker - in addition to bugs, also does simplification & style
- staticcheck
# Check struct tags.
- tagliatelle
# Test-related checks.
- usetesting
- testableexamples
- thelper
- tparallel
# Remove unnecessary type conversions, make code cleaner
- unconvert
# Must have. Finds unused declarations.
- unused
# Detect the possibility to use variables/constants from stdlib.
- usestdlibvars
# Finds wasted assignment statements.
- wastedassign
settings:
errcheck:
exclude-functions:
- io/ioutil.ReadFile
- io.Copy(*bytes.Buffer)
- io.Copy(os.Stdout)
gocritic:
disabled-checks:
- hugeParam
- rangeExprCopy
- rangeValCopy
enabled-tags:
- diagnostic
- opinionated
- performance
- style
nakedret:
# No naked returns
max-func-lines: 1
tagliatelle:
case:
rules:
avro: snake
bson: camel
json: camel
mapstructure: kebab
xml: camel
yaml: snake
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
issues:
# Show all issues in the project
max-issues-per-linter: 0
max-same-issues: 0
uniq-by-line: false
new: false
formatters:
enable:
- gofmt
- gofumpt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$