-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy path.golangci.yml
More file actions
176 lines (168 loc) · 5.45 KB
/
.golangci.yml
File metadata and controls
176 lines (168 loc) · 5.45 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
version: "2"
run:
tests: true
timeout: 5m
linters:
# Default v2 linter set options (standard/all/none/fast)
default: standard
enable:
# Critical / foundational
- staticcheck
- govet
- errcheck
- ineffassign
- unused
- errorlint
- revive
- gocritic
- makezero
- durationcheck
- nilerr
- bodyclose
- rowserrcheck
- sqlclosecheck
- noctx
- perfsprint
- sloglint
- nolintlint
- tparallel
- gosec
# Policy / helper
- depguard
- forbidigo
- copyloopvar
# Complexity / duplication (enabled for main code)
- goconst
- cyclop
- gocognit
- dupl
- unparam
- unconvert
disable:
# Linters with preference-dependent behavior; keep disabled for now
- exhaustruct
- varnamelen
- wsl
- nlreturn
- nonamedreturns
- funlen
- nakedret
- err113
- gochecknoglobals
# Test-only relaxations (disable specific linters for _test.go files)
exclusions:
rules:
- path: '(^|.*/)test/.*\.go'
linters:
- forbidigo # Allow fmt.Print / time.Sleep in tests
- revive # Ignore minor style issues inside tests
- gosec # Reduce false positives for simple test I/O
- dupl # Accept similar duplicated test cases
- gocognit # Relax complexity requirements for readability
- cyclop
- goconst # Loosen constant enforcement within tests
- funlen # Allow longer test functions
- nlreturn
- varnamelen
- wsl
- nolintlint # Allow simpler usage of //nolint in tests
- perfsprint # Relax performance-focused checks for tests
- unparam # Avoid false positives for unused parameters
- unconvert
settings:
# Detect loop variable capture issues
govet:
enable:
- loopclosure
# Block testify usage in tests (applies only to $test)
depguard:
rules:
main:
files:
- $all
- "!$test"
deny:
- pkg: syscall
desc: |
Deprecated: This package is locked down.
Callers should use the corresponding package in the golang.org/x/sys repository instead.
That is also where updates required by new systems or versions should be applied.
See https://golang.org/s/go1.4-syscall for more information.
- pkg: github.com/satori/go.uuid
desc: |
This package have vulnerability. Please use alternative uuid package such as "github.com/google/uuid".
- pkg: github.com/golang/protobuf/proto
desc: |
Deprecated: Use the "google.golang.org/protobuf/proto" package instead.
- pkg: github.com/golang/protobuf/ptypes
desc: |
Deprecated: Use the "google.golang.org/protobuf/types/known/anypb" package instead.
- pkg: github.com/golang/protobuf/ptypes/any
desc: |
Deprecated: Use the "google.golang.org/protobuf/types/known/anypb" package instead.
- pkg: github.com/golang/protobuf/ptypes/duration
desc: |
Deprecated: Use the "google.golang.org/protobuf/types/known/durationpb" package instead.
- pkg: github.com/golang/protobuf/ptypes/empty
desc: |
Deprecated: Use the "google.golang.org/protobuf/types/known/emptypb" package instead.
- pkg: github.com/golang/protobuf/ptypes/struct
desc: |
Deprecated: Use the "google.golang.org/protobuf/types/known/structpb" package instead.
- pkg: github.com/golang/protobuf/ptypes/timestamp
desc: |
Deprecated: Use the "google.golang.org/protobuf/types/known/timestamppb" package instead.
- pkg: github.com/golang/protobuf/ptypes/wrappers
desc: |
Deprecated: Use the "google.golang.org/protobuf/types/known/wrapperspb" package instead.
- pkg: github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap
desc: |
DO NOT USE ctxzap. Please check grpcserver/internal#LogWithFields.
- pkg: github.com/pkg/errors
desc: Should be replaced by standard lib errors package
- pkg: golang.org/x/sync/errgroup
desc: |
Use panic recoverable version github.com/kouzoh-mercoin/mercoin-core-kit/sync/recoverable or github.com/sourcegraph/conc instead.
test:
files:
- $test
deny:
- pkg: github.com/stretchr/testify
desc: |
DO NOT USE testing framework.
gocognit:
min-complexity: 20
goconst:
min-len: 3
min-occurrences: 3
dupl:
threshold: 200
revive:
rules:
- name: error-strings
- name: indent-error-flow
- name: exported
- name: package-comments
- name: redefines-builtin-id
- name: if-return
- name: superfluous-else
- name: var-naming
nolintlint:
require-explanation: true
require-specific: true
# v2 formatters (used by `golangci-lint fmt`)
formatters:
enable:
- gofmt
- goimports
- gofumpt
- gci
- golines
settings:
golines:
max-len: 120
gci:
sections:
- standard
- default
- prefix(github.com/your/module) # Replace with your module path