-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy path.golangci.yml
More file actions
54 lines (52 loc) · 1.67 KB
/
.golangci.yml
File metadata and controls
54 lines (52 loc) · 1.67 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
# golangci-lint configuration for batch-gateway.
#
# This is an initial setup to make golangci-lint pass cleanly.
# The rules below reflect what seemed reasonable at the time of writing,
# but they are not set in stone — feel free to propose changes in a PR
# if something doesn't fit the team's preferences.
#
# Key decision: defer X.Close() on read-only / cleanup resources is
# excluded from errcheck. Write-path Close errors (e.g. after writing
# to a file) should still be checked explicitly.
# v2 is required for Go 1.25+ (v1 does not support Go 1.25).
# See: https://github.com/golangci/golangci-lint/issues/5873
version: "2"
linters:
enable:
- depguard
- errcheck
- forbidigo
- gocritic
- govet
- staticcheck
- unused
settings:
depguard:
rules:
no-stdlib-log:
files:
- "!$test"
deny:
- pkg: "log$"
desc: "Use logr (github.com/go-logr/logr) instead of stdlib log"
gocritic:
disable-all: true
enabled-checks:
- ruleguard
settings:
ruleguard:
rules: "tools/rules.go"
errcheck:
exclude-functions:
# Read-only or cleanup Close — errors are unrecoverable and
# callers cannot meaningfully act on them.
- (*os.File).Close
- (io.Closer).Close
- (io.ReadCloser).Close
- (*net.TCPListener).Close
- (net.Conn).Close
forbidigo:
forbid:
- pattern: 'klog\.(ErrorS|Errorf|Error|InfoS|Infof|Info|WarningS|Warningf|Warning|V)$'
msg: "Use logr.Logger instead of klog for logging. Only klog.Flush/InitFlags/NewKlogr/Fatalf are allowed."
analyze-types: true