-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yml
147 lines (135 loc) · 4.36 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
# Copyright 2021 ClavinJune/serve
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
run:
# https://github.com/golangci/golangci-lint/issues/2649
go: '1.19'
# timeout for analysis, e.g. 30s, 5m, default is 1m
deadline: 5m
# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
# to go.mod are needed. This setting is most useful to check that go.mod does
# not need updates, such as in a continuous integration and testing system.
modules-download-mode: readonly
linters:
enable:
- "bodyclose"
- "depguard"
- "dupl"
- "goconst"
- "gocritic"
- "gofmt"
- "gocyclo"
- "goimports"
- "revive"
- "gosec"
- "gosimple"
- "lll"
- "misspell"
- "nakedret"
- "prealloc"
- "unconvert"
- "unparam"
- "gomoddirectives"
disable:
- "gochecknoglobals"
- "gochecknoinits"
# all available settings of specific linters
linters-settings:
errcheck:
check-type-assertions: true
check-blank: false
govet:
# report about shadowed variables
check-shadowing: true
settings:
printf: # analyzer name, run `go tool vet help` to see all analyzers
funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
gofmt:
simplify: true
gocyclo:
min-complexity: 10
dupl:
# tokens count to trigger issue, 150 by default
threshold: 100
goconst:
min-occurrences: 3
misspell:
locale: US
lll:
line-length: 150
unused:
check-exported: false
unparam:
check-exported: false
gocritic:
enabled-checks: # non-default checks we decided to also add
- boolExprSimplify
- builtinShadow
- commentedOutCode
- commentedOutImport
- docStub
- emptyFallthrough
- hexLiteral
- initClause
- methodExprCall
- nilValReturn
- octalLiteral
- typeAssertChain
- typeUnparen
- unnecessaryBlock
- weakCond
- yodaStyleExpr
- emptyStringTest
- importShadow
- nestingReduce
- paramTypeCombine
- ptrToRefParam
- sloppyReassign
- unlabelStmt
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks.
# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
enabled-tags: [ "performance" ]
settings: # settings passed to gocritic
captLocal: # must be valid enabled check name
paramsOnly: true
rangeValCopy:
sizeThreshold: 32
issues:
# List of regexps of issue texts to exclude, empty list by default.
# But independently from this option we use default exclude patterns,
# it can be disabled by `exclude-use-default: false`. To list all
# excluded by default patterns execute `golangci-lint run --help`
exclude: [ ]
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- errcheck
- dupl
- gosec
- lll
# Independently from option `exclude` we use default exclude patterns,
# it can be disabled by this option. To list all
# excluded by default patterns execute `golangci-lint run --help`.
# Default value for this option is true.
exclude-use-default: false
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-issues-per-linter: 0
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0