-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.golangci.yml
More file actions
85 lines (82 loc) · 1.97 KB
/
Copy path.golangci.yml
File metadata and controls
85 lines (82 loc) · 1.97 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
version: "2"
run:
timeout: 5m
formatters:
enable:
- gofumpt
settings:
gofumpt:
extra-rules: true
linters:
default: none
enable:
# Correctness (v2 defaults)
- errcheck
- govet
- staticcheck
- unused
- ineffassign
# Style
- revive
- errname
- predeclared
# Security
- gosec
# Resource leaks
- bodyclose
- sqlclosecheck
# Context discipline
- contextcheck
# Cleanup
- unconvert
- prealloc
settings:
revive:
rules:
- name: blank-imports
- name: context-as-argument
- name: dot-imports
- name: error-return
- name: error-strings
- name: increment-decrement
- name: var-naming
- name: range
- name: receiver-naming
- name: indent-error-flow
errcheck:
exclude-functions:
# Deferred cleanup — errors are not actionable.
- (database/sql.Rows).Close
- (*database/sql.Rows).Close
- (database/sql.Stmt).Close
- (*database/sql.Stmt).Close
- (database/sql.Tx).Rollback
- (*database/sql.Tx).Rollback
- (io.Closer).Close
- (*os.File).Close
- (*database/sql.DB).Close
- (net/http.ResponseWriter).Write
- (*text/tabwriter.Writer).Flush
- crypto/rand.Read
# CLI output — writing to stdout/stderr never fails in practice.
- fmt.Fprintf
- fmt.Fprintln
- fmt.Fprint
- (io.Writer).Write
- io.WriteString
gosec:
excludes:
- G104 # covered by errcheck
- G301 # 0o755 for directories is fine
- G304 # file paths come from CLI flags / config, not user HTTP input
- G306 # 0o644 for generated docs is fine
exclusions:
rules:
- path: _test\.go
linters:
- errcheck
- gosec
# SQL string formatting with parameterized values is safe.
- linters:
- gosec
text: "G20[12]"