-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.golangci.toml
More file actions
93 lines (74 loc) · 2.13 KB
/
Copy path.golangci.toml
File metadata and controls
93 lines (74 loc) · 2.13 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
version = "2"
[formatters]
enable = ["gci"]
[formatters.settings.gci]
sections = ["standard", "default", "prefix(github.com/aaomidi/tslink)"]
custom-order = true
[linters]
default = "standard"
enable = [
# Bug detection (critical for networking)
"bodyclose", # HTTP response bodies closed (Docker API)
"errorlint", # proper error wrapping
"nilerr", # nil error with invalid value
"nilnil", # simultaneous nil error + invalid value
"durationcheck", # two durations multiplied together
# Context (critical for process management)
"contextcheck", # correct context usage
"fatcontext", # nested contexts in loops
"noctx", # HTTP requests without context
# Code quality
"cyclop", # cyclomatic complexity
"dupl", # code clones
"goconst", # repeated strings
"gocritic", # bugs, perf, style
"unconvert", # unnecessary conversions
"unparam", # unused params
"wastedassign", # wasted assignments
# Modern Go (1.22+)
"intrange", # integer ranges
"copyloopvar", # loop variable issues
"modernize", # suggests modern Go idioms
# Style
"godot", # comments end in period
"nakedret", # naked returns
"nolintlint", # proper nolint directives
]
[linters.settings.cyclop]
max-complexity = 30
package-average = 10.0
[linters.settings.errcheck]
check-type-assertions = true
[linters.settings.govet]
enable-all = true
disable = ["fieldalignment", "shadow"]
[linters.settings.nakedret]
max-func-lines = 0
[linters.settings.nolintlint]
require-explanation = true
require-specific = true
[linters.exclusions]
presets = ["std-error-handling", "common-false-positives"]
[[linters.exclusions.rules]]
source = "TODO"
linters = ["godot"]
[[linters.exclusions.rules]]
path = "_test\\.go"
linters = [
"bodyclose",
"dupl",
"errcheck",
"goconst",
"gosec",
"noctx",
]
# Exclude noctx for utility packages where context isn't readily available
[[linters.exclusions.rules]]
path = "pkg/netutil/"
linters = ["noctx"]
[[linters.exclusions.rules]]
path = "pkg/diag/"
linters = ["noctx"]
[[linters.exclusions.rules]]
path = "pkg/tailscale/binary\\.go"
linters = ["noctx"]