-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yml
106 lines (95 loc) · 3.77 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
run:
go: '1.21'
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 2m
# exit code when at least one issue was found, default is 1
issues-exit-code: 0
# include test files or not, default is true
tests: true
# modules-download-mode: vendor #readonly #|release|vendor
linters:
disable-all: true
enable:
# Style checkers
- errname # errors prefixed with Err and error types suffixed with Error
- gofmt
- goimports
- misspell # finds commonly misspelled words
- nestif # deeply nested if statements
- stylecheck # (enabled by default)
- wastedassign # Finds wasted assignment statements
# Bug finders
- asciicheck
- bodyclose # HTTP response body is closed successfully
- contextcheck # checks non-inherited context
- errcheck # unchecked errors (enabled by default)
- gosec # inspects source code for security problems
- gosimple
- govet # suspicious constructs (enabled by default)
- ineffassign # assignments to existing variables are not used (enabled by default)
# - rowserrcheck # Err of rows is checked successfully
# - sqlclosecheck # sql.Rows and sql.Stmt are closed
- staticcheck
- typecheck # (enabled by default)
- unparam # reports unused function parameters
- unused # unused constants, variables, functions and types (enabled by default)
# disable:
# - goerr113 # checks errors are checked correctly
# - gosimple # same as staticcheck linter
linters-settings:
govet:
# Report about shadowed variables.
check-shadowing: true
stylecheck:
# STxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
# Default: ["*"]
checks: [
# https://staticcheck.io/docs/checks/
# Enable all rules by default (opinionated):
"all",
# Disable rules:
"-ST1000", # Package comments.
"-ST1003", # Capitalizations in fields' camel case name, e.g. 'nameID' instead of 'nameId'
]
initialisms: [
# Common.
"ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA",
"SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS",
"SIP", "RTP", "AMQP", "DB", "TS",
# Domain specific.
]
# https://staticcheck.io/docs/configuration/options/#http_status_code_whitelist
# Default: ["200", "400", "404", "500"]
http-status-code-whitelist: ["200", "400", "404", "500"]
# rowserrcheck:
# # database/sql is always checked
# # Default: []
# packages:
# - github.com/jmoiron/sqlx
errcheck:
# Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
check-type-assertions: true
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`.
check-blank: true
misspell:
locale: US
issues:
# Maximum issues count per one linter. Set to 0 to disable.
max-issues-per-linter: 100
# Maximum count of issues with the same text. Set to 0 to disable.
max-same-issues: 100
# Fix found issues (if it's supported by the linter)
fix: false
output:
# Format: colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions
# Output path can be either `stdout`, `stderr` or path to the file to write to.
# Example: "checkstyle:report.json,colored-line-number"
format: "github-actions,colored-line-number"
# Print lines of code with issue.
print-issued-lines: true
# Print linter name in the end of issue text.
print-linter-name: true
# Make issues output unique by line.
uniq-by-line: false
# Sort results by: filepath, line and column.
sort-results: true