Skip to content

Commit b8fc97d

Browse files
committed
fix: upgrade golangci-lint to v2 for Go 1.25 compatibility
- Migrate .golangci.yml to v2 format (version: "2") - Update CI action to golangci-lint-action@v9 with v2.10.1 - Remove gosimple (merged into staticcheck in v2) - Fix unchecked r.Body.Close() errors
1 parent 97f14f2 commit b8fc97d

4 files changed

Lines changed: 23 additions & 20 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ jobs:
3737
go-version: '1.25'
3838

3939
- name: golangci-lint
40-
uses: golangci/golangci-lint-action@v6
40+
uses: golangci/golangci-lint-action@v9
4141
with:
42-
version: latest
42+
version: v2.10.1

.golangci.yml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,35 @@
1+
version: "2"
2+
13
linters:
4+
default: standard
25
enable:
36
- errcheck
47
- govet
58
- staticcheck
69
- unused
7-
- gosimple
810
- ineffassign
911
- misspell
10-
- gofmt
11-
- goimports
1212
- unconvert
1313
- unparam
1414
- gocritic
1515
- revive
1616

17-
linters-settings:
18-
revive:
19-
rules:
20-
- name: exported
21-
severity: warning
22-
misspell:
23-
locale: US
24-
goimports:
25-
local-prefixes: github.com/gumeniukcom/golang-jsonrpc2
17+
settings:
18+
revive:
19+
rules:
20+
- name: exported
21+
severity: warning
22+
misspell:
23+
locale: US
24+
25+
formatters:
26+
enable:
27+
- gofmt
28+
- goimports
29+
settings:
30+
goimports:
31+
local-prefixes: github.com/gumeniukcom/golang-jsonrpc2
2632

2733
issues:
28-
exclude-dirs:
29-
- vendor
30-
exclude-generated: strict
3134
max-issues-per-linter: 50
3235
max-same-issues: 5

example/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func main() {
2222
if err != nil {
2323
panic(err)
2424
}
25-
defer r.Body.Close()
25+
defer func() { _ = r.Body.Close() }()
2626

2727
w.Header().Set("Content-Type", "application/json")
2828
w.WriteHeader(http.StatusOK)

main_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func TestAll(t *testing.T) {
5252
if err != nil {
5353
panic(err)
5454
}
55-
defer r.Body.Close()
55+
defer func() { _ = r.Body.Close() }()
5656

5757
w.Header().Set("Content-Type", "application/json")
5858
w.WriteHeader(http.StatusOK)
@@ -116,7 +116,7 @@ func TestCallPanic(t *testing.T) {
116116
if err != nil {
117117
panic(err)
118118
}
119-
defer r.Body.Close()
119+
defer func() { _ = r.Body.Close() }()
120120

121121
w.Header().Set("Content-Type", "application/json")
122122
w.WriteHeader(http.StatusOK)

0 commit comments

Comments
 (0)