-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy path.golangci.yml
More file actions
68 lines (61 loc) · 1.83 KB
/
.golangci.yml
File metadata and controls
68 lines (61 loc) · 1.83 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
version: "2"
run:
timeout: 5m
tests: true
issues-exit-code: 1
modules-download-mode: mod
issues:
max-issues-per-linter: 0
max-same-issues: 0
linters:
enable:
- misspell
- errcheck
- ineffassign
- staticcheck
- revive
- unused
- gocritic
- gosec
settings:
revive:
rules:
- name: argument-limit
arguments: [10]
- name: cognitive-complexity
arguments: [60] # Warn if function is too complex
- name: cyclomatic
arguments: [30] # Max allowed cyclomatic complexity
- name: deep-exit # Disallow early os.Exit in functions
- name: errorf # Use fmt.Errorf instead of fmt.Sprintf for errors
- name: unhandled-error
- name: redefines-builtin-id # Prevent redefining built-in names like 'error' or 'string'
- name: unused-parameter
- name: unreachable-code
# code style
- name: indent-error-flow
- name: if-return
- name: early-return
arguments: ["ID", "Id"] # Allow common initialisms like ID, URL, HTTP, JSON
- name: package-comments
- name: exported
- name: empty-block
- name: empty-lines
# performance
- name: constant-logical-expr
- name: range-val-in-closure
- name: range-val-address
- name: import-shadowing
- name: context-as-argument # Encourage passing context.Context as first param
- name: struct-tag
- name: receiver-naming
- name: bare-return # Discourage bare returns
# best practices
- name: defer
- name: error-return
- name: error-naming
- name: unnecessary-stmt
- name: redundant-import-alias
- name: modifies-parameter
- name: atomic
- name: time-naming