-
Notifications
You must be signed in to change notification settings - Fork 5k
Expand file tree
/
Copy path.golangci.yml
More file actions
executable file
·172 lines (172 loc) · 5.01 KB
/
.golangci.yml
File metadata and controls
executable file
·172 lines (172 loc) · 5.01 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
version: "2"
run:
build-tags:
- integration
linters:
default: none
enable:
- asciicheck
- bodyclose
- depguard
- durationcheck
- errcheck
- errorlint
- exhaustruct
- forbidigo
- gomoddirectives
- gomodguard
- gosec
- govet
- importas
- ineffassign
- misspell
- nakedret
- nilerr
- noctx
- nolintlint
- staticcheck
- testifylint
- unconvert
- unused
- wastedassign
settings:
depguard:
rules:
apache-licensed-code:
list-mode: lax
files:
- '!**/x-pack/**/*.go'
deny:
- pkg: github.com/elastic/beats/v7/x-pack
desc: Apache 2.0 licensed code cannot depend on Elastic licensed code (x-pack/).
- pkg: github.com/elastic/elastic-agent-client
desc: Apache 2.0 licensed code cannot depend on Elastic licensed code (elastic-agent-client).
main:
list-mode: lax
deny:
- pkg: math/rand$
desc: superseded by math/rand/v2
- pkg: golang.org/x/exp/maps$
desc: superseded by maps
- pkg: golang.org/x/exp/slices$
desc: superseded by slices
errcheck:
check-type-assertions: true
check-blank: false
exclude-functions:
- (github.com/elastic/elastic-agent-libs/mapstr.M).Delete
- (github.com/elastic/elastic-agent-libs/mapstr.M).Put
- github.com/elastic/elastic-agent-libs/logp.TestingSetup
- github.com/elastic/elastic-agent-libs/logp.DevelopmentSetup
errorlint:
errorf: true
asserts: true
comparison: true
exhaustruct:
include:
# BaseMetricSet must be created via NewModule to ensure paths are set.
- 'github\.com/elastic/beats/v7/metricbeat/mb\.BaseMetricSet'
forbidigo:
forbid:
- pattern: fmt.Print.*
- pattern: ^paths\.Resolve$
msg: "use a per-beat *paths.Path instance instead of the global paths.Resolve"
- pattern: ^paths\.InitPaths$
msg: "use a per-beat *paths.Path instance instead of the global paths.InitPaths"
- pattern: ^paths\.Paths$
msg: "use a per-beat *paths.Path instance instead of the global paths.Paths"
- pattern: ^logp\.NewLogger$
msg: "accept a *logp.Logger as a parameter instead of creating one with logp.NewLogger"
- pattern: ^logp\.L$
msg: "accept a *logp.Logger as a parameter instead of using the global logp.L()"
gomoddirectives:
replace-allow-list:
- github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption
- github.com/Shopify/sarama
- github.com/apoydence/eachers
- github.com/dop251/goja
- github.com/dop251/goja_nodejs
- github.com/fsnotify/fsevents
- github.com/fsnotify/fsnotify
- github.com/google/gopacket
- github.com/insomniacslk/dhcp
- github.com/meraki/dashboard-api-go/v3
- github.com/snowflakedb/gosnowflake
replace-local: false
gomodguard:
blocked:
modules:
- github.com/pkg/errors:
recommendations:
- errors
- fmt
reason: This package is deprecated, use `fmt.Errorf` with `%w` instead
- go.uber.org/multierr:
recommendations:
- errors
reason: This package is deprecated, use `errors.Join` instead
- gotest.tools/v3:
recommendations:
- github.com/stretchr/testify
reason: Use one assertion library consistently across the codebase
- github.com/google/uuid:
recommendations:
- github.com/gofrs/uuid/v5
reason: Use one uuid library consistently across the codebase
gosec:
excludes:
- G306
- G404
- G401
- G501
- G505
nolintlint:
require-explanation: true
require-specific: false
allow-unused: false
prealloc:
simple: false
range-loops: true
for-loops: true
staticcheck:
checks:
- -ST1005
- all
testifylint:
disable:
- go-require # Disabled: too many false positives, can be used to exit a goroutine
- require-error # Disabled: using assert for error checks lets the test continue, maximizing context on failure
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- staticcheck
text: 'ST1003:'
- linters:
- forbidigo
path: (.*magefile.go|.*dev-tools/mage/.*)
paths:
- third_party$
- builtin$
- examples$
issues:
max-issues-per-linter: 50
max-same-issues: 3
formatters:
enable:
- goimports
settings:
goimports:
local-prefixes:
- github.com/elastic
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$