-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path.golangci.yml
More file actions
123 lines (109 loc) · 3.13 KB
/
Copy path.golangci.yml
File metadata and controls
123 lines (109 loc) · 3.13 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
version: "2"
run:
timeout: 5m
tests: true
modules-download-mode: readonly
formatters:
enable:
- gofmt # Check for code formatting
- goimports # Check for import formatting
settings:
gofmt:
simplify: true
linters:
enable:
- errcheck # Check for unchecked errors
- govet # Vet examines Go source code
- ineffassign # Detect ineffectual assignments
- staticcheck # Go static analysis
- unused # Check for unused code
- misspell # Check for misspelled words
- revive # Drop-in replacement for golint
- unparam # Report unused function parameters
- unconvert # Remove unnecessary type conversions
- goconst # Find repeated strings that could be constants
- dupl # Code clone detection
- nolintlint # Ensure nolint directives are properly formatted
- gosec # Security checker for Go code
- bodyclose # Check for HTTP response body close
- gocritic # Comprehensive Go source code linter
# Dispatch-level linters
- errname # Check error type naming conventions
- exhaustive # Check exhaustiveness of enum switch statements
- forcetypeassert # Find forced type assertions
- makezero # Find slice declarations not initialized with zero length
- nilerr # Find code returning nil error incorrectly
- noctx # Find HTTP requests without context
- prealloc # Find slice pre-allocation opportunities
- predeclared # Find shadowed predeclared identifiers
- tparallel # Detect inappropriate t.Parallel() usage
- wastedassign # Find wasted assignments
settings:
errcheck:
check-type-assertions: true
check-blank: false
exclude-functions:
- (os).RemoveAll
- (os).Remove
- fmt.Print
- fmt.Println
- fmt.Printf
- fmt.Fprint
- fmt.Fprintln
- fmt.Fprintf
- (*net/http.Response.Body).Close
- (io.Closer).Close
govet:
disable:
- fieldalignment
revive:
rules:
- name: exported
arguments:
- "checkPrivateReceivers"
- "disableStutteringCheck"
misspell:
locale: US
dupl:
threshold: 200
goconst:
min-len: 3
min-occurrences: 4
exhaustive:
default-signifies-exhaustive: true
gocritic:
disabled-checks:
- ifElseChain
- appendAssign
- elseif
exclusions:
rules:
- path: _test\.go
linters:
- dupl
- goconst
- unparam
- prealloc
- noctx
- exhaustive
- path: magefile\.go
linters:
- unparam
- errcheck
# CLI tool legitimately uses exec.Command with variable args
- path: (cmd|internal)/
linters:
- gosec
text: "G204:"
# CLI tool needs to read files with variable paths
- path: internal/
linters:
- gosec
text: "G304:"
issues:
max-issues-per-linter: 0
max-same-issues: 0
output:
formats:
text:
path: stdout