-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.golangci.yml
More file actions
65 lines (61 loc) · 1.75 KB
/
.golangci.yml
File metadata and controls
65 lines (61 loc) · 1.75 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
version: "2"
run:
timeout: 5m
linters:
exclusions:
rules:
- path: _test\.go
linters:
- bodyclose
enable:
- errcheck
- govet
- ineffassign
- staticcheck
- unused
- misspell
- unconvert
- gocritic
- nolintlint
# Error handling
- errorlint # proper error wrapping with errors.Is/As
- nilerr # return nil when err != nil
# Safety
- bodyclose # HTTP response body must be closed
- forcetypeassert # type assertions must be checked
- gosec # security issues (command injection, hardcoded creds, weak crypto)
- nilnesserr # checks err != nil but returns different nil error
# Code quality
- predeclared # shadowing of predeclared identifiers
- dupword # duplicate words in comments
# Modern Go idioms (Go 1.21+)
- modernize # use modern Go idioms (any, slices.Contains, etc.)
- perfsprint # faster alternatives to fmt.Sprintf/Errorf
- exhaustive # check exhaustiveness of enum switch statements
- intrange # use Go 1.22 range-over-integers
- copyloopvar # detect issues with loop variable copying
# Consistency
- recvcheck # check receiver type consistency
- nilnil # check for nil,nil returns (excluding intentional cases)
# Testing
- testifylint # check testify best practices
settings:
gocritic:
enabled-tags:
- diagnostic
- style
- performance
nolintlint:
require-explanation: true
require-specific: true
formatters:
enable:
- gofmt
- goimports
settings:
goimports:
local-prefixes:
- github.com/vertti/preflight
issues:
max-issues-per-linter: 0
max-same-issues: 0