-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path.golangci.yml
More file actions
123 lines (105 loc) · 3.11 KB
/
Copy path.golangci.yml
File metadata and controls
123 lines (105 loc) · 3.11 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
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
version: '2'
run:
timeout: 5m
tests: true
modules-download-mode: readonly
linters:
enable:
- errcheck # Check for unchecked errors
- govet # Standard Go vet checks
- ineffassign # Detect ineffectual assignments
- staticcheck # Advanced static analysis (includes gosimple)
- unused # Check for unused code
- misspell # Check spelling
- gocritic # Comprehensive linter with many checks
- revive # Fast, configurable, extensible linter
- gosec # Security-focused linter
- unconvert # Remove unnecessary type conversions
- unparam # Find unused function parameters
- bodyclose # Check HTTP response bodies are closed
- noctx # Find http requests without context
- sqlclosecheck # Check SQL rows/statements are closed
- rowserrcheck # Check SQL rows errors are checked
disable:
- exhaustive # Can be too strict for switch statements
- exhaustruct # Can be too strict for struct initialization
- funlen # Function length check can be subjective
- gochecknoglobals # Globals sometimes needed
- gocyclo # Cyclomatic complexity can be subjective
- godox # Allow TODO/FIXME comments
- lll # Line length too strict
- nestif # Nesting depth can be subjective
- wsl # Whitespace linter too opinionated
settings:
govet:
enable-all: true
disable:
- shadow
- fieldalignment # Struct field ordering for memory optimization is too pedantic
staticcheck:
checks: ['all']
errcheck:
check-type-assertions: true
check-blank: true
gosec:
excludes:
- G104 # Allow some unhandled errors where appropriate
severity: medium
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- captLocal
revive:
rules:
- name: exported
severity: warning
- name: unexported-return
severity: warning
- name: var-naming
severity: warning
exclusions:
rules:
# Exclude some linters from running on tests files
- path: _test\.go
linters:
- gosec
- unparam
# Exclude known linters from partially hard-vendored code
- path: vendor/
linters:
- all
# Exclude shadow checking on short variable names
- linters:
- govet
text: 'shadow: declaration of "(err|ctx)"'
# Allow capitalized local variable names (SRP uses A, B, M1, M2 per RFC 5054)
- linters:
- gocritic
text: 'captLocal:'
# Internal compute functions have error returns for API consistency
- linters:
- unparam
text: 'result 1 \(error\) is always nil'
path: srp\.go
issues:
# Maximum issues count per one linter
max-issues-per-linter: 0
# Maximum count of issues with the same text
max-same-issues: 0
# Unique issues by line
uniq-by-line: true
output:
formats:
text:
path: stdout
print-linter-name: true
print-issued-lines: true
colors: true
sort-order:
- linter
- file