Skip to content

Commit 42afd95

Browse files
linter: Update linter config
Remove deprecated linters and add working setting for previously excluded linters.
1 parent 81fc509 commit 42afd95

File tree

1 file changed

+47
-8
lines changed

1 file changed

+47
-8
lines changed

.golangci.yml

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ linters-settings:
1818
gofmt:
1919
# simplify code: gofmt with `-s` option, true by default
2020
simplify: true
21+
funlen:
22+
# Checks the number of lines in a function.
23+
# If lower than 0, disable the check.
24+
lines: 200
25+
# Checks the number of statements in a function.
26+
statements: 80
27+
gosec:
28+
excludes:
29+
- G402 # Look for bad TLS connection settings.
30+
- G306 # Poor file permissions used when writing to a new file.
2131

2232
linters:
2333
enable-all: true
@@ -32,16 +42,45 @@ linters:
3242
# them even longer by marking them as 'nolint'.
3343
- lll
3444

35-
# We don't care (enough) about misaligned structs to lint that.
45+
# Deprecated linters. See https://golangci-lint.run/usage/linters/.
46+
- interfacer
47+
- golint
3648
- maligned
37-
38-
# We have long functions, especially in tests. Moving or renaming those
39-
# would trigger funlen problems that we may not want to solve at that time.
40-
- funlen
41-
42-
# Gosec is outdated and reports false positives.
43-
- gosec
49+
- scopelint
50+
- exhaustivestruct
51+
- bodyclose
52+
- contextcheck
53+
- nilerr
54+
- noctx
55+
- rowserrcheck
56+
- sqlclosecheck
57+
- structcheck
58+
- tparallel
59+
- unparam
60+
- wastedassign
61+
- ifshort
62+
- varcheck
63+
- deadcode
64+
- nosnakecase
4465

4566
issues:
4667
# Only show newly introduced problems.
4768
new-from-rev: 4008b92d81d4d62e663025c5f79ebe44b53f283c
69+
70+
exclude-rules:
71+
# Exclude gosec from running for tests so that tests with weak randomness
72+
# (math/rand) will pass the linter. We also exclude funlen from tests as
73+
# have test functions that are intentionally long.
74+
- path: _test\.go
75+
linters:
76+
- gosec
77+
- funlen
78+
79+
- path: test*
80+
linters:
81+
- gosec
82+
- funlen
83+
84+
- path: itest/.*
85+
linters:
86+
- paralleltest

0 commit comments

Comments
 (0)