-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path.golangci.yaml
More file actions
123 lines (102 loc) · 4.11 KB
/
.golangci.yaml
File metadata and controls
123 lines (102 loc) · 4.11 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"
# Options for analysis running.
run:
# Timeout for running analysis (default: 1m, set to 10m here)
timeout: 10m
# The default concurrency value is the number of available CPU.
concurrency: 4
# output configuration options.
output:
formats:
text:
path: stdout
colors: true
print-issued-lines: true
print-linter-name: true
linters:
# Disable all linters.
default: none
# Directories to skip during analysis.
exclusions:
paths:
- images
- .github
- examples
- hack
# Enable specific linter
# https://golangci-lint.run/usage/linters/#enabled-by-default
enable:
# Errcheck is a program for checking for unchecked errors in Go code. These unchecked errors can be critical bugs in some cases.
- errcheck
# Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string.
- govet
# Detects when assignments to existing variables are not used.
- ineffassign
# It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary.
# The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint.
- staticcheck
# Checks whether HTTP response body is closed successfully.
- bodyclose
# Provides diagnostics that check for bugs, performance and style issues.
# Extensible without recompilation through dynamic rules.
# Dynamic rules are written declaratively with AST patterns, filters, report message and optional suggestion.
- gocritic
# Finds repeated strings that could be replaced by a constant.
- goconst
# Finds commonly misspelled English words in comments.
- misspell
# Finds naked returns in functions greater than a specified function length.
- nakedret
settings:
errcheck:
# Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
# Such cases aren't reported by default.
# Default: false
check-type-assertions: false
# 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:
- (*Client).Close
# Display function signature instead of selector.
# Default: false
verbose: true
staticcheck:
# SAxxxx checks in https://staticcheck.dev/docs/configuration/options/#checks
# Example (to disable some checks): [ "all", "-SA1000", "-SA1001"]
# Default: ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022"]
checks:
- "all"
# Incorrect or missing package comment.
# https://staticcheck.dev/docs/checks/#ST1000
- "-ST1000"
# Poorly chosen identifier.
# https://staticcheck.dev/docs/checks/#ST1003
- "-ST1003"
# Poorly chosen receiver name.
# https://staticcheck.dev/docs/checks/#ST1006
- "-ST1006"
# Use consistent method receiver names.
# https://staticcheck.dev/docs/checks/#ST1016
- "-ST1016"
# The documentation of an exported function should start with the function's name.
# https://staticcheck.dev/docs/checks/#ST1020
- "-ST1020"
# The documentation of an exported type should start with type's name.
# https://staticcheck.dev/docs/checks/#ST1021
- "-ST1021"
# The documentation of an exported variable or constant should start with variable's name.
# https://staticcheck.dev/docs/checks/#ST1022
- "-ST1022"
nakedret:
# Make an issue if func has more lines of code than this setting, and it has naked returns.
# Default: 30
max-func-lines: 50
goconst:
# Minimum number of occurrences to suggest converting to constant (default: 3)
min-occurrences: 3
formatters:
enable:
# Gofmt checks whether code was gofmt-ed. By default, this tool runs with -s option to check for code simplification.
- gofmt
# Handles imports addition/removal (relies on gci for grouping)
- goimports