Skip to content

Commit fe747a0

Browse files
committed
linter: migrate .golangci.yml from v1 to v2
Migrated with `golangci-lint migrate --skip-validation`
1 parent 37d0be2 commit fe747a0

File tree

1 file changed

+111
-129
lines changed

1 file changed

+111
-129
lines changed

.golangci.yml

Lines changed: 111 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,131 @@
1+
version: "2"
12
run:
3+
go: "1.24"
4+
25
# timeout for analysis
36
timeout: 4m
4-
5-
go: "1.23"
6-
7-
linters-settings:
8-
govet:
9-
# Don't report about shadowed variables
10-
shadowing: false
11-
12-
gofmt:
13-
# simplify code: gofmt with `-s` option, true by default
14-
simplify: true
15-
16-
tagliatelle:
17-
case:
18-
rules:
19-
json: snake
20-
21-
whitespace:
22-
multi-func: true
23-
multi-if: true
24-
25-
gosec:
26-
excludes:
27-
- G402 # Look for bad TLS connection settings.
28-
- G306 # Poor file permissions used when writing to a new file.
29-
- G115 # Integer overflow conversion.
30-
31-
staticcheck:
32-
checks: [ "-SA1019" ]
337

348
linters:
35-
enable-all: true
9+
default: all
3610
disable:
37-
# Global variables are used in many places throughout the code base.
38-
- gochecknoglobals
39-
40-
# Some lines are over 80 characters on purpose and we don't want to make them
41-
# even longer by marking them as 'nolint'.
42-
- lll
43-
44-
# We want to allow short variable names.
45-
- varnamelen
46-
47-
# We want to allow TODOs.
48-
- godox
49-
50-
# We have long functions, especially in tests. Moving or renaming those would
51-
# trigger funlen problems that we may not want to solve at that time.
52-
- funlen
53-
54-
# Disable for now as we haven't yet tuned the sensitivity to our codebase
55-
# yet. Enabling by default for example, would also force new contributors to
56-
# potentially extensively refactor code, when they want to smaller change to
57-
# land.
58-
- gocyclo
59-
- gocognit
11+
- containedctx
12+
- contextcheck
6013
- cyclop
61-
62-
# Instances of table driven tests that don't pre-allocate shouldn't trigger
63-
# the linter.
64-
- prealloc
65-
66-
# Init functions are used by loggers throughout the codebase.
67-
- gochecknoinits
68-
69-
# Causes stack overflow, see https://github.com/polyfloyd/go-errorlint/issues/19.
14+
- depguard
15+
- dogsled
16+
- err113
17+
- errname
7018
- errorlint
71-
72-
# New linters that need a code adjustment first.
73-
- wrapcheck
74-
- nolintlint
75-
- paralleltest
76-
- tparallel
77-
- testpackage
78-
- gofumpt
19+
- exhaustive
20+
- exhaustruct
21+
- forcetypeassert
22+
- funlen
23+
- gochecknoglobals
24+
- gochecknoinits
25+
- gocognit
26+
- gocyclo
27+
- godox
7928
- gomoddirectives
29+
- inamedparam
30+
- interfacebloat
31+
- intrange
8032
- ireturn
8133
- maintidx
82-
- nlreturn
83-
- dogsled
84-
- gci
85-
- containedctx
86-
- contextcheck
87-
- errname
88-
- err113
8934
- mnd
90-
- noctx
9135
- nestif
92-
- wsl
93-
- exhaustive
94-
- forcetypeassert
9536
- nilerr
9637
- nilnil
97-
- stylecheck
98-
- thelper
99-
- revive
100-
- tagalign
101-
- depguard
102-
- interfacebloat
103-
- inamedparam
104-
- intrange
38+
- nlreturn
39+
- noctx
40+
- nolintlint
41+
- paralleltest
10542
- perfsprint
43+
- prealloc
10644
- protogetter
45+
- revive
46+
- tagalign
10747
- testifylint
108-
109-
# Additions compared to LND
110-
- exhaustruct
111-
48+
- testpackage
49+
- thelper
50+
- tparallel
51+
- varnamelen
52+
- wrapcheck
53+
- wsl
54+
- funcorder
55+
- wsl_v5
56+
- noinlineerr
57+
settings:
58+
gosec:
59+
excludes:
60+
- G402
61+
- G306
62+
- G115
63+
staticcheck:
64+
checks:
65+
- -SA1019
66+
tagliatelle:
67+
case:
68+
rules:
69+
json: snake
70+
whitespace:
71+
multi-if: true
72+
multi-func: true
73+
exclusions:
74+
generated: lax
75+
presets:
76+
- comments
77+
- common-false-positives
78+
- legacy
79+
- std-error-handling
80+
rules:
81+
- linters:
82+
- forbidigo
83+
- gosec
84+
- unparam
85+
path: _test\.go
86+
- linters:
87+
- gosec
88+
path: _mock\.go
89+
- linters:
90+
- errcheck
91+
- forbidigo
92+
path: cmd/loopd/*
93+
- linters:
94+
- forbidigo
95+
path: loopd/*
96+
- linters:
97+
- errcheck
98+
- forbidigo
99+
path: cmd/loop/*
100+
- linters:
101+
- forbidigo
102+
path: fsm/stateparser/*
103+
- linters:
104+
- lll
105+
path: loopd/config.go
106+
- linters:
107+
- lll
108+
path: loopdb/*
109+
paths:
110+
- \.pb\.go$
111+
- \.pb\.gw\.go$
112+
- third_party$
113+
- builtin$
114+
- examples$
112115
issues:
113-
# Only show newly introduced problems.
114116
new-from-rev: 36838cf7f464cf73b0201798063b2caffeae4250
115-
116-
exclude-files:
117-
- "\\.pb\\.go$"
118-
- "\\.pb\\.gw\\.go$"
119-
120-
exclude-rules:
121-
# Allow fmt.Printf() in test files
122-
- path: _test\.go
123-
linters:
124-
- forbidigo
125-
- unparam
126-
- gosec
127-
- path: _mock\.go
128-
linters:
129-
- gosec
130-
131-
# Allow fmt.Printf() in loopd
132-
- path: cmd/loopd/*
133-
linters:
134-
- forbidigo
135-
- errcheck
136-
- path: loopd/*
137-
linters:
138-
- forbidigo
139-
140-
# Allow fmt.Printf() in loop
141-
- path: cmd/loop/*
142-
linters:
143-
- forbidigo
144-
- errcheck
145-
146-
# Allow fmt.Printf() in stateparser
147-
- path: fsm/stateparser/*
148-
linters:
149-
- forbidigo
117+
formatters:
118+
enable:
119+
- gofmt
120+
- goimports
121+
settings:
122+
gofmt:
123+
simplify: true
124+
exclusions:
125+
generated: lax
126+
paths:
127+
- \.pb\.go$
128+
- \.pb\.gw\.go$
129+
- third_party$
130+
- builtin$
131+
- examples$

0 commit comments

Comments
 (0)