Skip to content

Commit d308ecf

Browse files
committed
Upgrade golangci-lint to v2
1 parent 2bfdb0a commit d308ecf

File tree

3 files changed

+73
-56
lines changed

3 files changed

+73
-56
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
go: ["1.23", "1.24"]
17+
go: ["1.24"]
1818
steps:
1919
- uses: actions/checkout@v4
2020
- uses: actions/setup-go@v5
@@ -38,9 +38,9 @@ jobs:
3838
go-version: "1.24"
3939
cache: false
4040
- name: Run lint
41-
uses: golangci/golangci-lint-action@v6
41+
uses: golangci/golangci-lint-action@v8
4242
with:
43-
version: v1.64
43+
version: v2.1
4444
args: --timeout 5m
4545

4646
govulncheck:

.golangci.yml

Lines changed: 69 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,81 @@
1-
linters-settings:
2-
gocyclo:
3-
min-complexity: 25
4-
gofmt:
5-
simplify: true
6-
misspell:
7-
locale: US
8-
govet:
9-
disable:
10-
- shadow
11-
- nilness
12-
enable-all: true
13-
errcheck:
14-
exclude-functions:
15-
- (*gorm.io/gorm.DB).AddError
16-
testifylint:
17-
disable:
18-
- require-error
19-
- error-nil
20-
- formatter
21-
- encoded-compare
22-
revive:
23-
rules:
24-
- name: var-naming
25-
arguments:
26-
- [] # AllowList
27-
- ["DTO"] # DenyList
28-
- name: unused-parameter
29-
disabled: false
30-
1+
version: "2"
312
linters:
323
enable:
33-
- gofmt
34-
- revive
4+
- bodyclose
5+
- copyloopvar
356
- gocyclo
7+
- inamedparam
368
- misspell
37-
- bodyclose
9+
- revive
10+
- testifylint
11+
- whitespace
3812
- govet
3913
- unused
4014
- errcheck
41-
- copyloopvar
42-
- gosimple
4315
- ineffassign
4416
- staticcheck
45-
- testifylint
46-
- whitespace
47-
- bodyclose
48-
- inamedparam
49-
disable-all: false
50-
fast: false
51-
17+
settings:
18+
errcheck:
19+
exclude-functions:
20+
- (*gorm.io/gorm.DB).AddError
21+
gocyclo:
22+
min-complexity: 25
23+
govet:
24+
disable:
25+
- shadow
26+
- nilness
27+
enable-all: true
28+
misspell:
29+
locale: US
30+
revive:
31+
rules:
32+
- name: var-naming
33+
disabled: false
34+
arguments:
35+
- [] # AllowList
36+
- ["DTO"] # DenyList
37+
- name: unused-parameter
38+
disabled: false
39+
testifylint:
40+
disable:
41+
- require-error
42+
- error-nil
43+
- formatter
44+
- encoded-compare
45+
staticcheck:
46+
checks:
47+
[
48+
"all",
49+
"-ST1000",
50+
"-ST1003",
51+
"-ST1016",
52+
"-ST1020",
53+
"-ST1021",
54+
"-ST1022",
55+
"-QF1001",
56+
]
57+
exclusions:
58+
generated: strict
59+
rules:
60+
- linters:
61+
- gocyclo
62+
path: _test\.go
63+
- path: (.+)\.go$
64+
text: should have a package comment
65+
- path: (.+)\.go$
66+
text: type name will be used as filter.FilterValidator by other packages, and that stutters; consider calling this Validator
67+
paths:
68+
- .github
5269
issues:
53-
exclude-use-default: false
5470
max-issues-per-linter: 0
5571
max-same-issues: 0
56-
exclude-dirs:
57-
- .github
58-
exclude:
59-
- should have a package comment
60-
- type name will be used as filter.FilterValidator by other packages, and that stutters; consider calling this Validator
61-
exclude-rules:
62-
- path: _test\.go
63-
linters:
64-
- gocyclo
72+
formatters:
73+
enable:
74+
- gofmt
75+
settings:
76+
gofmt:
77+
simplify: true
78+
exclusions:
79+
generated: strict
80+
paths:
81+
- .github

join.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func findStatementJoin(stmt *gorm.Statement, join *clause.Join) bool {
213213

214214
func quoteString(stmt *gorm.Statement, str string) string {
215215
writer := bytes.NewBufferString("")
216-
stmt.DB.Dialector.QuoteTo(writer, str)
216+
stmt.Dialector.QuoteTo(writer, str)
217217
return writer.String()
218218
}
219219

0 commit comments

Comments
 (0)