-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.golangci.yml
142 lines (128 loc) · 4.55 KB
/
.golangci.yml
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
# Options for analysis running.
# Defines the configuration version.
# The only possible value is "2".
version: "2"
# Options for analysis running.
run:
# If set, we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
# to go.mod are needed. This setting is most useful to check that go.mod does not
# need updates, such as in a continuous integration and testing system.
# If invoked with -mod=vendor, the go command assumes that the vendor directory
# holds the correct copies of dependencies and ignores the dependency descriptions
# in go.mod.
#
# Allowed values: readonly|vendor|mod
# Default: ""
modules-download-mode: readonly
# Include test files or not.
# Default: true
tests: false
issues:
# Maximum issues count per one linter.
# Set to 0 to disable.
# Default: 50
max-issues-per-linter: 0
# Maximum count of issues with the same text.
# Set to 0 to disable.
# Default: 3
max-same-issues: 0
formatters:
# Enable specific formatter.
# Default: [] (uses standard Go formatting)
enable:
- gofmt
- goimports
linters:
# Default set of linters.
# The value can be: `standard`, `all`, `none`, or `fast`.
# Default: standard
default: none
# Enable specific linter
# https://golangci-lint.run/usage/linters/
enable:
##
# Default linters
##
# Check for unchecked errors in Go code
- errcheck
# Vet examines Go source code and reports suspicious constructs
- govet
# Detects when assignments to existing variables are not used
- ineffassign
# Set of rules from staticcheck (https://staticcheck.io/docs/configuration/options/#checks)
- staticcheck
# Checks Go code for unused constants, variables, functions and types
- unused
##
# Additional linters
##
# Checks whether HTTP response body is closed successfully
- bodyclose
# Tool for code clone detection
- dupl
# Checks types passed to the json encoding functions.
- errchkjson
# Finds repeated strings that could be replaced by a constant
- goconst
# Computes and checks the cyclomatic complexity of functions
- gocyclo
# Tool for detection of FIXME, TODO and other comment keywords
- godox
# Inspects source code for security problems
- gosec
# Finds commonly misspelled English words
- misspell
# Finds the code that returns nil even if it checks that the error is not nil
- nilerr
# Reports ill-formed or insufficient nolint directives.
- nolintlint
# Checks that fmt.Sprintf can be replaced with a faster alternative
- perfsprint
# Finds slice declarations that could potentially be pre-allocated
- prealloc
# Checks whether Rows.Err of rows is checked successfully
- rowserrcheck
# Remove unnecessary type conversions
- unconvert
# Reports unused function parameters
- unparam
# Check for unnecessary newlines at the start and end of functions, if, for, etc.
- whitespace
# Settings of specific linters
settings:
errcheck:
# List of functions to exclude from checking, where each entry is a single function to exclude.
# See https://github.com/kisielk/errcheck#excluding-functions for details.
exclude-functions:
- (io.ReadCloser).Close
- (io.WriteCloser).Close
- (io.ReadWriteCloser).Close
- (*os.File).Close
goconst:
# Minimal length of string constant.
# Default: 3
min-len: 2
# Minimum occurrences of constant string count to trigger issue.
# Default: 3
min-occurrences: 3
govet:
# Settings per analyzer
settings:
# Analyzer name, run `go tool vet help` to see all analyzers
printf:
# Comma-separated list of print function names to check (in addition to default, see `go tool vet help printf`).
# Default: []
funcs:
- (github.com/sirupsen/logrus).Debugf
- (github.com/sirupsen/logrus).Infof
- (github.com/sirupsen/logrus).Warnf
- (github.com/sirupsen/logrus).Errorf
- (github.com/sirupsen/logrus).Fatalf
staticcheck:
# SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
# Default: ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022"]
checks:
- all
- "-ST1000" # Packages must have a package comment that is formatted according to the guidelines