Skip to content

Commit 66c0ee5

Browse files
committed
chore: upgrade golangci-lint to v2.2.1
1 parent ebe22dc commit 66c0ee5

File tree

4 files changed

+108
-90
lines changed

4 files changed

+108
-90
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
env:
1515
GO_VERSION: stable
16-
GOLANGCI_LINT_VERSION: v1.62.0
16+
GOLANGCI_LINT_VERSION: v2.2.1
1717
CGO_ENABLED: 0
1818

1919
steps:

.golangci.yml

Lines changed: 76 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,65 @@
1+
version: "2"
2+
13
run:
24
timeout: 10m
35

4-
linters-settings:
5-
govet:
6-
enable-all: true
7-
disable:
8-
- fieldalignment
9-
gocyclo:
10-
min-complexity: 15
11-
goconst:
12-
min-len: 5
13-
min-occurrences: 3
14-
misspell:
15-
locale: US
16-
funlen:
17-
lines: -1
18-
statements: 50
19-
godox:
20-
keywords:
21-
- FIXME
22-
gofumpt:
23-
extra-rules: true
24-
depguard:
25-
rules:
26-
main:
27-
deny:
28-
- pkg: "github.com/instana/testify"
29-
desc: not allowed
30-
- pkg: "github.com/pkg/errors"
31-
desc: Should be replaced by standard lib errors package
32-
gocritic:
33-
enabled-tags:
34-
- diagnostic
35-
- style
36-
- performance
37-
disabled-checks:
38-
- sloppyReassign
39-
- rangeValCopy
40-
- octalLiteral
41-
- paramTypeCombine # already handle by gofumpt.extra-rules
42-
- unnamedResult
43-
- hugeParam
44-
tagliatelle:
45-
case:
6+
linters:
7+
settings:
8+
govet:
9+
enable-all: true
10+
disable:
11+
- fieldalignment
12+
gocyclo:
13+
min-complexity: 15
14+
goconst:
15+
min-len: 5
16+
min-occurrences: 3
17+
misspell:
18+
locale: US
19+
funlen:
20+
lines: -1
21+
statements: 50
22+
godox:
23+
keywords:
24+
- FIXME
25+
depguard:
4626
rules:
47-
json: pascal
48-
gosec:
49-
excludes:
50-
- G304
51-
- G306
27+
main:
28+
deny:
29+
- pkg: "github.com/instana/testify"
30+
desc: not allowed
31+
- pkg: "github.com/pkg/errors"
32+
desc: Should be replaced by standard lib errors package
33+
gocritic:
34+
enabled-tags:
35+
- diagnostic
36+
- style
37+
- performance
38+
disabled-checks:
39+
- sloppyReassign
40+
- rangeValCopy
41+
- octalLiteral
42+
- paramTypeCombine # already handle by gofumpt.extra-rules
43+
- unnamedResult
44+
- hugeParam
45+
tagliatelle:
46+
case:
47+
rules:
48+
json: pascal
49+
gosec:
50+
excludes:
51+
- G304
52+
- G306
5253

53-
linters:
54-
enable-all: true
54+
default: all
5555
disable:
56-
- exportloopref # deprecated
5756
- sqlclosecheck # not relevant (SQL)
5857
- rowserrcheck # not relevant (SQL)
5958
- cyclop # duplicate of gocyclo
6059
- lll
6160
- dupl
6261
- wsl
62+
- wsl_v5
6363
- nlreturn
6464
- mnd
6565
- err113
@@ -78,17 +78,35 @@ linters:
7878
- errchkjson
7979
- contextcheck
8080

81+
exclusions:
82+
warn-unused: true
83+
rules:
84+
- text: fmt.Sprintf can be replaced with string
85+
linters:
86+
- perfsprint
87+
8188
issues:
82-
exclude-use-default: false
8389
max-issues-per-linter: 0
8490
max-same-issues: 0
85-
exclude:
86-
- 'fmt.Sprintf can be replaced with string'
87-
exclude-rules:
88-
- path: .*_test.go
89-
linters:
90-
- funlen
91-
- noctx
91+
92+
formatters:
93+
enable:
94+
- gci
95+
- gofmt
96+
- gofumpt
97+
- goimports
98+
- golines
99+
100+
settings:
101+
gofumpt:
102+
extra-rules: true
103+
104+
golines:
105+
max-len: 200
106+
tab-len: 4
107+
shorten-comments: true
108+
reformat-tags: false
109+
chain-split-dots: false
92110

93111
output:
94112
show-stats: true

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
default: clean lint test build
44

55
lint:
6-
golangci-lint run
6+
go run github.com/golangci/golangci-lint/v2/cmd/[email protected] run
77

88
clean:
99
rm -rf cover.out

syrup.go

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,36 @@ type Syrup struct {
9898
Signature *types.Signature
9999
}
100100

101+
// Call generates mock.Call wrapper.
102+
func (s Syrup) Call(writer io.Writer, methods []*types.Func) error {
103+
err := s.callBase(writer)
104+
if err != nil {
105+
return err
106+
}
107+
108+
err = s.typedReturns(writer)
109+
if err != nil {
110+
return err
111+
}
112+
113+
err = s.returnsFn(writer)
114+
if err != nil {
115+
return err
116+
}
117+
118+
err = s.typedRun(writer)
119+
if err != nil {
120+
return err
121+
}
122+
123+
err = s.callMethodsOn(writer, methods)
124+
if err != nil {
125+
return err
126+
}
127+
128+
return s.callMethodOnRaw(writer, methods)
129+
}
130+
101131
// MockMethod generates method mocks.
102132
func (s Syrup) MockMethod(writer io.Writer) error {
103133
err := s.mockedMethod(writer)
@@ -312,36 +342,6 @@ func (s Syrup) methodOnRaw(writer io.Writer) error {
312342
return w.Err()
313343
}
314344

315-
// Call generates mock.Call wrapper.
316-
func (s Syrup) Call(writer io.Writer, methods []*types.Func) error {
317-
err := s.callBase(writer)
318-
if err != nil {
319-
return err
320-
}
321-
322-
err = s.typedReturns(writer)
323-
if err != nil {
324-
return err
325-
}
326-
327-
err = s.returnsFn(writer)
328-
if err != nil {
329-
return err
330-
}
331-
332-
err = s.typedRun(writer)
333-
if err != nil {
334-
return err
335-
}
336-
337-
err = s.callMethodsOn(writer, methods)
338-
if err != nil {
339-
return err
340-
}
341-
342-
return s.callMethodOnRaw(writer, methods)
343-
}
344-
345345
func (s Syrup) callBase(writer io.Writer) error {
346346
base := template.New("templateCallBase").Funcs(template.FuncMap{
347347
"ToGoCamel": strcase.ToGoCamel,

0 commit comments

Comments
 (0)