-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.golangci.yml
72 lines (71 loc) · 3.42 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
#https://golangci-lint.run/usage/linters/
linters:
enable:
# Simple linter to check that your code does not contain non-ASCII identifiers
# 用于检查代码是否包含非 ASCII 标识符的简单行
- asciicheck
# Checks for dangerous unicode character sequences
# 检查危险的 Unicode字符序列
- bidichk
# checks whether HTTP response body is closed successfully
# Body close 检查 HTTP 响应主体是否成功关闭
- bodyclose
# Checks assignments with too many blank identifiers (e.g. x, , , _, := f())
- dogsled
# Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
# Errcheck 是一个程序,用于检查 Go 程序中未检查的错误。在某些情况下,这些未经检查的错误可能是严重的错误
- errcheck
# Checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error.
# 检查前哨错误是否以 Err 作为前缀,错误类型是否以 Error 作为后缀。
- errname
# checks for pointers to enclosing loop variables
# 检查循环变量包含指针
- exportloopref
# Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
# Gofmt 检查代码是否是被格式化的(Gofmt-ed)。默认情况下,该工具运行 -s 选项来检查代码是否简化
- gofmt
# In addition to fixing imports, goimports also formats your code in the same style as gofmt.
# 除了修复导入之外,goimport 还将代码格式设置为与 gofmt 相同的样式。
- goimports
# Linter for Go source code that specializes in simplifying code
# 专门用于简化代码的 Go 源代码的 Linter
- gosimple
# Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
# Vet 检查 Go 源代码并报告可疑的结构,例如参数数量与格式字符串不一致的 Printf 调用
- govet
# Detects when assignments to existing variables are not used
# 检测对现有变量的赋值没被使用
- ineffassign
# Finds slice declarations with non-zero initial length
# 查找初始长度为非零的 slice 声明
- makezero
# Finds commonly misspelled English words in comments
- misspell
# noctx finds sending http request without context.Context
- noctx
# Like the front-end of a Go compiler, parses and type-checks Go code
- typecheck
# Remove unnecessary type conversions
- unconvert
# Checks Go code for unused constants, variables, functions and types
- unused
# wastedassign finds wasted assignment statements.
- wastedassign
# Tool for detection of leading and trailing whitespace
- whitespace
# Computes and checks the cyclomatic complexity of functions
- gocyclo
#https://golangci-lint.run/usage/configuration/
run:
# Timeout for analysis, e.g. 30s, 5m.
# Default: 1m
timeout: 5m
# Which files to skip: they will be analyzed, but issues from them won't be reported.
# Default value is empty list,
# but there is no need to include all autogenerated files,
# we confidently recognize autogenerated files.
# If it's not please let us know.
# "/" will be replaced by current OS file path separator to properly work on Windows.
skip-files:
- ".+_test.go"
- ".+_test_.+.go"