Skip to content

Commit 598344e

Browse files
committed
adding go linter
1 parent 0fee5f8 commit 598344e

File tree

1 file changed

+122
-0
lines changed

1 file changed

+122
-0
lines changed

.golangci.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
linters-settings:
2+
dupl:
3+
threshold: 100
4+
exhaustive:
5+
default-signifies-exhaustive: false
6+
# funlen:
7+
# lines: 100
8+
# statements: 50
9+
goconst:
10+
min-len: 2
11+
min-occurrences: 2
12+
gocritic:
13+
enabled-tags:
14+
- diagnostic
15+
- experimental
16+
- opinionated
17+
- performance
18+
- style
19+
disabled-checks:
20+
- dupImport # https://github.com/go-critic/go-critic/issues/845
21+
- ifElseChain
22+
# gocyclo:
23+
# min-complexity: 15
24+
goimports:
25+
local-prefixes: github.com/golangci/golangci-lint
26+
golint:
27+
min-confidence: 0
28+
gomnd:
29+
settings:
30+
mnd:
31+
# don't include the "operation" and "assign"
32+
checks: argument,case,condition,return
33+
govet:
34+
check-shadowing: true
35+
settings:
36+
printf:
37+
funcs:
38+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
39+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
40+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
41+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
42+
# lll:
43+
# line-length: 140
44+
maligned:
45+
suggest-new: true
46+
misspell:
47+
locale: US
48+
nolintlint:
49+
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
50+
allow-unused: false # report any unused nolint directives
51+
require-explanation: false # don't require an explanation for nolint directives
52+
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
53+
54+
linters:
55+
# please, do not use `enable-all`: it's deprecated and will be removed soon.
56+
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
57+
disable-all: true
58+
enable:
59+
- bodyclose
60+
- deadcode
61+
- dogsled
62+
- dupl
63+
- errcheck
64+
- exhaustive
65+
- gochecknoinits
66+
- goconst
67+
- gocritic
68+
- gofmt
69+
- goimports
70+
- golint
71+
- gomnd
72+
- goprintffuncname
73+
- gosimple
74+
- govet
75+
- ineffassign
76+
- interfacer
77+
- maligned
78+
- misspell
79+
- nakedret
80+
- noctx
81+
- nolintlint
82+
- rowserrcheck
83+
- scopelint
84+
- staticcheck
85+
- structcheck
86+
- stylecheck
87+
- typecheck
88+
- unconvert
89+
- unparam
90+
- unused
91+
- varcheck
92+
- whitespace
93+
94+
# don't enable:
95+
# - depguard
96+
# - asciicheck
97+
# - funlen
98+
# - gochecknoglobals
99+
# - gocognit
100+
# - gocyclo
101+
# - godot
102+
# - godox
103+
# - goerr113
104+
# - gosec
105+
# - lll
106+
# - nestif
107+
# - prealloc
108+
# - testpackage
109+
# - wsl
110+
111+
issues:
112+
exclude-use-default: false
113+
exclude:
114+
# should have a package comment, unless it's in another file for this package (golint)
115+
- 'in another file for this package'
116+
117+
# golangci.com configuration
118+
# https://github.com/golangci/golangci/wiki/Configuration
119+
service:
120+
golangci-lint-version: 1.31.x # use the fixed version to not introduce new linters unexpectedly
121+
prepare:
122+
- echo "here I can run custom commands, but no preparation needed for this repo"

0 commit comments

Comments
 (0)