Skip to content

Commit 5f8f3bb

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

File tree

1 file changed

+48
-8
lines changed

1 file changed

+48
-8
lines changed

.golangci.yml

Lines changed: 48 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,46 @@ 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
65+
- exhaustruct
4466

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

0 commit comments

Comments
 (0)