-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.golangci.yml
175 lines (174 loc) · 3.73 KB
/
.golangci.yml
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# https://github.com/MarioCarrion/todo-api-microservice-example/blob/main/.golangci.yml
run:
skip-files: # ignore yaml error...
- ".*\\.xo\\.go$"
- ".*\\.gen\\.go$"
- ".*\\.pb\\.go$"
linters:
enable-all: true
disable:
- nlreturn
- mnd
- dupword
- ireturn # oapi-codegen strict handlers
# - interfacebloat
- thelper
- testpackage
- depguard
# - json(camel)
- funlen
- lll
- wsl
- nosnakecase
- godox # marks TODO, FIX, ...
- forbidigo # fmt banned, etc.
- goerr113
- gofumpt
- gomnd
- nonamedreturns
# deprecated
- exhaustivestruct
- golint
- interfacer
- maligned
- scopelint
# disabled because of go1.18, added to avoid the initial warning when running
# https://github.com/golangci/golangci-lint/issues/2649
- bodyclose
- contextcheck
- nilerr
- noctx
# - rowserrcheck
- sqlclosecheck
- structcheck
- unparam
- wastedassign
# broken --fix for generated code
- tagalign
linters-settings:
errcheck:
check-type-assertions: true
check-blank: true
exclude-functions:
- io/ioutil.ReadFile
- io.Copy(*bytes.Buffer)
- io.Copy(os.Stdout)
gofmt:
simplify: true
lll:
line-length: 130
tagliatelle:
case:
use-field-name: true
rules:
json: goCamel
yaml: goCamel
staticcheck:
go: "1.22"
checks:
- "all"
gci:
sections:
- standard
- default
- prefix(github.com/danicc097/openapi-go-gin-postgres-sqlc)
skip-generated: true
exhaustruct:
include:
- "github.com/danicc097/openapi-go-gin-postgres-sqlc/internal.*Params"
ireturn:
allow:
- error
- stdlib
- "go.opentelemetry.io/otel/trace.Span"
varnamelen:
max-distance: 20
ignore-type-assert-ok: true
ignore-map-index-ok: true
ignore-chan-recv-ok: true
ignore-names:
- id
- tx
- ctx
ignore-decls:
- d db.DBTX
- c *gin.Context
- b bytes.Buffer
- h http.Handler
- id string
- ok bool
- r *http.Request
- w http.ResponseWriter
wrapcheck:
ignoreSigs:
- internaldomain.WrapErrorf(
- internaldomain.NewErrorf(
- internal.NewErrorf(
- internal.WrapErrorf(
- .Errorf(
- errors.New(
- errors.Unwrap(
- .Wrap(
- .Wrapf(
- .WithMessage(
- .WithMessagef(
- .WithStack(
ignorePackageGlobs:
- github.com/danicc097/openapi-go-gin-postgres-sqlc/*
issues:
exclude-rules:
- path: "internal/testutil/*" # doesn't work with internal/... for some reason
linters:
- gosec
- path: "."
linters:
- gci
- nolintlint
- path: internal/gen/
linters:
- lll
- godot
- wsl
# All tests
- path: _test\.go
linters:
- errcheck
- cyclop
- errchkjson
- exhaustruct
- funlen
- goerr113
- lll
- nonamedreturns
- nosnakecase
- varnamelen
- wrapcheck
# Handles the C4 diagrams
- path: internal/doc/doc.go
linters:
- lll
- revive
- stylecheck
# Final binaries
- path: cmd/
linters:
- cyclop
- funlen
- gocognit
- unparam
- path: cmd/internal/repos/postgresql.go
linters:
- revive # blank-imports
- path: internal/memcached/task.go
linters:
- lll
# Because of the env var testing and using t.Setenv
- path: internal/envvar/envvar_test.go
linters:
- paralleltest
- thelper
- tparallel
# Because these are tools
- path: internal/tools/tools.go
linters:
- typecheck