-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy path.golangci.toml
120 lines (105 loc) · 2.95 KB
/
.golangci.toml
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
[run]
timeout = "10m"
tests = true
# Have to include all interesting tags:
# https://github.com/golangci/golangci-lint/issues/517
build-tags = [
"sudo",
"netnstest",
"manual",
]
skip-files = [ ".*goaviatrix/client_mock\\.go" ]
[issues]
fix = true
[linters]
disable-all = true
enable = [
"bodyclose",
"errcheck",
"errname",
"errorlint",
"forcetypeassert",
"gofumpt",
"goimports",
"gosec",
"gosimple",
"govet",
"importas",
"ineffassign",
"revive",
"staticcheck",
"testifylint",
"typecheck",
"unconvert",
"unused",
]
[linters-settings.goimports]
local-prefixes = "aviatrix.com"
[linters-settings.testifylint]
enable-all = true
disable-all = false
disable = [ "require-error" ]
[linters-settings.gosec]
excludes = [
"G306",
"G115",
"G601", # Not relevant for go1.22+
]
[linters-settings.govet]
enable-all = true
disable = [
"fieldalignment",
"shadow",
"unusedwrite",
]
[linters-settings.govet.settings.printf]
funcs = [
"(*go.uber.org/zap.SugaredLogger).DPanicf",
"(*go.uber.org/zap.SugaredLogger).Debugf",
"(*go.uber.org/zap.SugaredLogger).Infof",
"(*go.uber.org/zap.SugaredLogger).Warnf",
"(*go.uber.org/zap.SugaredLogger).Errorf",
"(*go.uber.org/zap.SugaredLogger).Fatalf",
"(*go.uber.org/zap.SugaredLogger).Panicf",
]
# Keep this in sync with go/aviatrix.com/staticcheck.conf.
[linters-settings.staticcheck]
checks = [
"all",
# staticcheck omits quickfixes unless the --debug.run-quickfix-analyzers
# flag is set. Make this config explicit until staticcheck can run the
# QF checks without crashing.
"-QF*",
# Experimentallly, the staticcheck "all" option doesn't turn on
# non-default checks, so we have to enable those explicitly to
# be consistent with the Bazel nogo analyzer.
"ST1016", # Use consistent method receiver names
"SA9003", # Empty body in an if or else branch
"-ST1023", # Unnecessary variable types, could be inferred.
"-ST1000", # Incorrect or missing package comment
"-ST1003", # Poorly chosen identifier
]
[linters-settings.revive]
[[linters-settings.revive.rules]]
name = "atomic"
[[linters-settings.revive.rules]]
name = "blank-imports"
[[linters-settings.revive.rules]]
name = "context-keys-type"
[[linters-settings.revive.rules]]
name = "range"
[[linters-settings.revive.rules]]
name = "receiver-naming"
[[linters-settings.revive.rules]]
name = "unreachable-code"
# Disable funlen for tests. Many table driven tests are naturally quite long
[[issues.exclude-rules]]
linters = [ "funlen" ]
source = "^func Test"
# Disable testifylint's "require-error" check. This check has marginal
# value, and there are a lot of instances in the codebase.
#
# See also https://github.com/golangci/golangci-lint/issues/4187
[[issues.exclude-rules]]
linters = [ "testifylint" ]
text = "require-error: for error assertions use require"