Skip to content

Commit ea1d4a2

Browse files
committed
Migrate golangci-lint configuration to v2 schema
- Convert configuration to golangci-lint v2 format - Use version: "2" (string format as required) - Replace disable-all/enable-all with linters.default: false - Move gofmt/goimports to formatters section - Keep all existing linter settings and exclusions - This resolves configuration validation errors in CI
1 parent 6abf5ca commit ea1d4a2

1 file changed

Lines changed: 52 additions & 44 deletions

File tree

.golangci.yml

Lines changed: 52 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,37 @@
1-
version: 2
1+
version: "2"
22

33
run:
44
timeout: 5m
55
modules-download-mode: readonly
66

7+
output:
8+
formats:
9+
- format: colored-line-number
10+
path: stdout
11+
12+
linters:
13+
default: false
14+
enable:
15+
- errcheck
16+
- gosimple
17+
- govet
18+
- ineffassign
19+
- staticcheck
20+
- unused
21+
- goconst
22+
- gocyclo
23+
- gosec
24+
- misspell
25+
- unconvert
26+
- unparam
27+
- gocritic
28+
- revive
29+
30+
formatters:
31+
enable:
32+
- gofmt
33+
- goimports
34+
735
linters-settings:
836
errcheck:
937
check-type-assertions: true
@@ -24,83 +52,63 @@ linters-settings:
2452
simplify: true
2553
gosec:
2654
excludes:
27-
- G404 # Use of weak random number generator is acceptable for cache keys
28-
29-
linters:
30-
disable-all: true
31-
enable:
32-
- errcheck
33-
- gosimple
34-
- govet
35-
- ineffassign
36-
- staticcheck
37-
- unused
38-
- goconst
39-
- gocyclo
40-
- gofmt
41-
- goimports
42-
- gosec
43-
- misspell
44-
- unconvert
45-
- unparam
46-
- gocritic
47-
- revive
55+
- G404
4856

4957
issues:
5058
exclude-rules:
5159
- path: _test\.go
5260
linters:
5361
- gosec
5462
- gocritic
55-
- errcheck # Test files often don't need to check all errors
56-
- goconst # Test files often have repeated strings
57-
- unparam # Test functions often have unused params
58-
- revive # Test files often have complex structures
59-
- gocyclo # Test functions can be complex
63+
- errcheck
64+
- goconst
65+
- unparam
66+
- revive
67+
- gocyclo
6068
- path: bench_test\.go
6169
linters:
62-
- errcheck # Benchmark files focus on performance, not error handling
63-
- unparam # Benchmark functions often have unused params
70+
- errcheck
71+
- unparam
6472
- path: examples/
6573
linters:
6674
- gosec
6775
- gocritic
6876
- path: internal/singleflight/
6977
linters:
70-
- revive # Allow non-standard error position for singleflight API compatibility
78+
- revive
7179
- path: pkg/obcache/wrap\.go
7280
linters:
73-
- errcheck # Complex reflection code needs some unchecked errors
74-
- revive # Allow complex if-else structure for reflection logic
81+
- errcheck
82+
- revive
7583
- path: internal/store/memory/memory\.go
7684
linters:
77-
- goimports # Allow alias import for LRU library
85+
- goimports
7886
- path: internal/eviction/
7987
linters:
80-
- revive # Allow EvictionType naming
81-
- goimports # Allow alias import for LRU library
88+
- revive
89+
- goimports
8290
- path: internal/store/redis/redis\.go
8391
linters:
84-
- errcheck # Redis operations may have ignored errors for performance
85-
- revive # Allow certain code patterns for Redis integration
92+
- errcheck
93+
- revive
8694
- path: pkg/obcache/logging\.go
8795
linters:
88-
- revive # Allow empty blocks in example code
89-
- staticcheck # Allow empty branches in example code
96+
- revive
97+
- staticcheck
9098
- text: "SA1029.*should not use built-in type string as key"
9199
linters:
92-
- staticcheck # Allow string keys in context for testing/examples
100+
- staticcheck
93101
- text: "SA9003.*empty branch"
94102
linters:
95-
- staticcheck # Allow empty branches in example code
103+
- staticcheck
96104
- path: pkg/obcache/logging_test.go
97105
linters:
98-
- staticcheck # Test code may have intentional nil checks
106+
- staticcheck
99107
- text: "unused-parameter.*seems to be unused"
100108
linters:
101-
- revive # Allow unused parameters in interface implementations
109+
- revive
102110
- text: "result.*is always nil"
103111
linters:
104-
- unparam # Allow methods that always return nil for interface compliance
112+
- unparam
105113
max-issues-per-linter: 0
106114
max-same-issues: 0

0 commit comments

Comments
 (0)