-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.golangci.yml
130 lines (115 loc) · 3.02 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
# 运行配置
run:
# 要使用的CPU核心数
concurrency: 4
# 分析超时,30m, 5m, 默认1m
timeout: 1m
# 退出代码, default is 1
issues-exit-code: 1
# 是否包含单元测试文件, default is true
tests: true
# 跳过目录
skip-dirs:
# - src/external_libs
# - autogenerated_by_my_lib
# 跳过默认目录:vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true
# 包管理模式,go modules使用readonly
modules-download-mode: readonly
# 输出配置
output:
# 输出格式:colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
format: colored-line-number
# 打印有问题的代码行号, default is true
print-issued-lines: true
# 在问题文本的未尾打印检查器名称, default is true
print-linter-name: true
# 使问题的输出逐行唯一, default is true
uniq-by-line: true
# 质量检查配置
linters-settings:
# 错误检查
errcheck:
# 检查类型错误
check-type-assertions: false
# 检查空标识符
check-blank: true
# 忽略文件
ignore: fmt:.*,io/ioutil:^Read.*
govet:
# 检查影子变量
check-shadowing: true
# 检查函数的复杂程度
gocyclo:
# 最小复杂性
min-complexity: 10
maligned:
# 为内存对齐优化给出新的结构体字段排序建议
suggest-new: true
depguard:
list-type: blacklist
include-go-root: false
packages:
- github.com/davecgh/go-spew/spew
lll:
line-length: 120
tab-width: 1
unused:
check-exported: true
unparam:
check-exported: false
gocritic:
enabled-checks:
disabled-checks:
enabled-tags:
- performance
settings: # settings passed to gocritic
captLocal: # must be valid enabled check name
paramsOnly: true
rangeValCopy:
sizeThreshold: 32
linters:
enable:
- megacheck
- govet
- maligned
- prealloc
- typecheck
enable-all: false
disable:
- unused
disable-all: false
presets:
- bugs
fast: false
issues:
exclude: /bin
exclude-rules:
# 设置某个目录的排除规则
- path: _test\.go
linters:
- gocyclo
- errcheck
- dupl
- gosec
- path: internal/hmac/
text: "weak cryptographic primitive"
linters:
- gosec
# 排序一些staticcheck消息
- linters:
- staticcheck
text: "SA9003:"
# Exclude lll issues for long lines with go:generate
- linters:
- lll
source: "^//go:generate "
# Independently from option `exclude` we use default exclude patterns,
# it can be disabled by this option. To list all
# excluded by default patterns execute `golangci-lint run --help`.
# Default value for this option is true.
exclude-use-default: false
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-issues-per-linter: 0
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0