Skip to content

Commit 2bc1a66

Browse files
committed
Complete golangci-lint v2 configuration with standard linters
- Use 'standard' linter set as baseline instead of 'none' - Disable problematic linters (typecheck, varnamelen, wsl) - Add useful additional linters (goconst, gocyclo, gosec, misspell, etc.) - Configure linter settings for errcheck, govet, gocyclo, goconst, gosec - Add comprehensive exclusion rules for test files, examples, and specific patterns - This should provide a working v2 configuration that passes CI
1 parent 74ba3f5 commit 2bc1a66

1 file changed

Lines changed: 69 additions & 7 deletions

File tree

.golangci.yml

Lines changed: 69 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,79 @@ version: "2"
22

33
run:
44
timeout: 5m
5+
modules-download-mode: readonly
56

67
linters:
7-
default: none
8+
default: standard
9+
disable:
10+
# Disable overly strict linters for this project
11+
- typecheck # Handled by Go compiler
12+
- varnamelen # Too strict for our use case
13+
- wsl # Too opinionated about whitespace
814
enable:
9-
- errcheck
10-
- gosimple
11-
- govet
12-
- ineffassign
13-
- staticcheck
14-
- unused
15+
# Add some useful additional linters
16+
- goconst
17+
- gocyclo
18+
- gosec
19+
- misspell
20+
- unconvert
21+
- unparam
22+
23+
linters-settings:
24+
errcheck:
25+
check-type-assertions: true
26+
check-blank: true
27+
28+
govet:
29+
check-shadowing: true
30+
31+
gocyclo:
32+
min-complexity: 15
33+
34+
goconst:
35+
min-len: 2
36+
min-occurrences: 2
37+
38+
gosec:
39+
excludes:
40+
- G404 # Use of weak random number generator is acceptable for cache keys
1541

1642
issues:
43+
exclude-rules:
44+
# Test files are allowed to be less strict
45+
- path: _test\.go
46+
linters:
47+
- gosec
48+
- errcheck
49+
- goconst
50+
- unparam
51+
- gocyclo
52+
53+
# Benchmark files focus on performance
54+
- path: bench_test\.go
55+
linters:
56+
- errcheck
57+
- unparam
58+
59+
# Example files can be less strict
60+
- path: examples/
61+
linters:
62+
- gosec
63+
64+
# Reflection code needs some flexibility
65+
- path: pkg/obcache/wrap\.go
66+
linters:
67+
- errcheck
68+
69+
# Allow string keys in context for testing
70+
- text: "should not use built-in type string as key"
71+
linters:
72+
- staticcheck
73+
74+
# Allow empty branches in example code
75+
- text: "empty branch"
76+
linters:
77+
- staticcheck
78+
1779
max-issues-per-linter: 0
1880
max-same-issues: 0

0 commit comments

Comments
 (0)