-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy path.golangci.yaml
191 lines (191 loc) · 7.12 KB
/
.golangci.yaml
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
run:
linters:
disable-all: true
enable:
- errcheck
- copyloopvar
- depguard
- gocritic
- gofumpt
- goimports
- gosimple
- govet
- ineffassign
- misspell
- typecheck
- unconvert
- unparam
- unused
- gci
fast: false
linters-settings:
govet:
disable:
# report about shadowed variables
- shadow
- copylocks
goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
local-prefixes: github.com/howardjohn/pilot-load/
unparam:
check-exported: false
gci:
sections:
- standard # Captures all standard packages if they do not match another section.
- default # Contains all imports that could not be matched to another section type.
- prefix(github.com/howardjohn/pilot-load/) # Groups all imports with the specified Prefix.
gocritic:
depguard:
rules:
DenyGogoProtobuf:
files:
- $all
deny:
- pkg: github.com/gogo/protobuf
desc: "gogo/protobuf is deprecated, use golang/protobuf"
# deny for all go files
AllGoFiles:
files:
- $all
deny:
- pkg: golang.org/x/net/http2/h2c
desc: "h2c.NewHandler is unsafe; use wrapper istio.io/istio/pkg/h2c"
- pkg: github.com/golang/protobuf/jsonpb
desc: "don't use the jsonpb package directly; use util/protomarshal instead"
- pkg: google.golang.org/protobuf/encoding/protojson
desc: "don't use the protojson package directly; use util/protomarshal instead"
- pkg: gomodules.xyz/jsonpatch/v3
desc: "don't use v3; v2 is orders of magnitude higher performance"
- pkg: k8s.io/apimachinery/pkg/util/sets
desc: "use istio.io/istio/pkg/util/sets"
- pkg: k8s.io/utils/set
desc: "use istio.io/istio/pkg/util/sets"
- pkg: k8s.io/utils/env
desc: "use istio.io/istio/pkg/env"
- pkg: k8s.io/utils/strings/slices
desc: "use istio.io/istio/pkg/slices"
- pkg: k8s.io/utils/pointer
desc: "use istio.io/istio/pkg/ptr"
- pkg: go.opencensus.io
desc: "do not use OpenCensus; use OpenTelemetry instead"
- pkg: golang.org/x/exp/maps
desc: "do not use golang.org/x/exp/maps; use istio.io/istio/pkg/maps instead"
- pkg: maps
desc: "do not use maps; use istio.io/istio/pkg/maps instead"
- pkg: golang.org/x/exp/slices
desc: "do not use golang.org/x/exp/slices; use istio.io/istio/pkg/slices instead"
- pkg: slices
desc: "do not use slices; use istio.io/istio/pkg/slices instead"
- pkg: gopkg.in/yaml.v2
desc: "do not use gopkg.in/yaml.v2; use sigs.k8s.io/yaml instead"
- pkg: gopkg.in/yaml.v3
desc: "do not use gopkg.in/yaml.v3; use sigs.k8s.io/yaml instead"
- pkg: github.com/ghodss/yaml
desc: "do not use github.com/ghodss/yaml; use sigs.k8s.io/yaml instead"
DenyOperatorAndIstioctl:
files:
# Tests can do anything
- "!$test"
# Main code should only be used by appropriate binaries
- "!**/operator/**"
- "!**/istioctl/**"
- "!**/tools/bug-report/**"
# This should only really import operator API, but that is hard to express without a larger refactoring
- "!**/pkg/kube/**"
- "!**/pkg/url/**"
- "!**/pkg/test/framework/**"
- "!**/tests/fuzz/**"
deny:
- pkg: istio.io/istio/operator
desc: "operator should not be imported"
- pkg: istio.io/istio/istioctl
desc: "istioctl should not be imported"
DenyOpenTelemetry:
files:
- $all
- "!**/pkg/monitoring/**"
- "!**/pkg/tracing/**"
deny:
- pkg: go.opentelemetry.io/otel
desc: "do not use OpenTelemetry directly; use pkg/monitoring"
- pkg: go.opentelemetry.io/otel/metric
desc: "do not use OpenTelemetry directly; use pkg/monitoring"
DenyProtobufV1:
files:
- $all
deny:
- pkg: github.com/golang/protobuf/ptypes
desc: "do not use github.com/golang/protobuf/ptypes; use google.golang.org/protobuf/types/known instead"
gosec:
includes:
- G401
- G402
- G404
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:
- composite literal uses unkeyed fields
# Which dirs to exclude: issues from them won't be reported.
# Can use regexp here: `generated.*`, regexp is applied on full path,
# including the path prefix if one is set.
# Default dirs are skipped independently of this option's value (see exclude-dirs-use-default).
# "/" will be replaced by current OS file path separator to properly work on Windows.
# Default: []
exclude-dirs:
- genfiles$
- vendor$
# Which files to exclude: they will be analyzed, but issues from them won't be reported.
# There is no need to include all autogenerated files,
# we confidently recognize autogenerated files.
# If it's not, please let us know.
# "/" will be replaced by current OS file path separator to properly work on Windows.
# Default: []
exclude-files:
- ".*\\.pb\\.go"
- ".*\\.gen\\.go"
exclude-rules:
# Exclude some linters from running on test files.
- path: _test\.go$|^tests/|^samples/
linters:
- errcheck
- maligned
- path: _test\.go$
text: "dot-imports: should not use dot imports"
# We need to use the deprecated module since the jsonpb replacement is not backwards compatible.
- linters:
- staticcheck
text: "SA1019: package github.com/golang/protobuf/jsonpb"
- linters:
- staticcheck
text: 'SA1019: "github.com/golang/protobuf/jsonpb"'
# This is not helpful. The new function is not very usable and the current function will not be removed
- linters:
- staticcheck
text: 'SA1019: grpc.Dial is deprecated: use NewClient instead'
- linters:
- staticcheck
text: 'SA1019: grpc.DialContext is deprecated: use NewClient instead'
- linters:
- staticcheck
text: "SA1019: grpc.WithBlock is deprecated"
- linters:
- staticcheck
text: "SA1019: grpc.FailOnNonTempDialError"
- linters:
- staticcheck
text: "SA1019: grpc.WithReturnConnectionError"
# 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: true
# Maximum issues count per one linter.
# Set to 0 to disable.
# Default: 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