Skip to content

Commit c38bd1f

Browse files
build(deps): bump golangci/golangci-lint-action from 6 to 7 (#43)
* build(deps): bump golangci/golangci-lint-action from 6 to 7 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6 to 7. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](golangci/golangci-lint-action@v6...v7) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * chore: update golangci-lint configuration and Makefile for v2 Signed-off-by: Flc <four_leaf_clover@foxmail.com> * refactor: replace 'interface{}' with 'any' for improved type clarity Signed-off-by: Flc <four_leaf_clover@foxmail.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Flc <four_leaf_clover@foxmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Flc <four_leaf_clover@foxmail.com>
1 parent fe9e369 commit c38bd1f

File tree

7 files changed

+31
-18
lines changed

7 files changed

+31
-18
lines changed

.github/workflows/lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ jobs:
2222
with:
2323
go-version: stable
2424
- name: golangci-lint
25-
uses: golangci/golangci-lint-action@v6
25+
uses: golangci/golangci-lint-action@v7

.golangci.yml

+20-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
version: "2"
2+
13
linters:
2-
disable-all: true
4+
default: none
35

46
enable:
57
- bodyclose
@@ -8,21 +10,32 @@ linters:
810
- errcheck
911
- copyloopvar
1012
- govet
11-
- gosimple
12-
- gofmt
13-
- gofumpt
1413
- goconst
15-
- goimports
1614
- mnd
1715
- gocyclo
1816
- ineffassign
1917
- lll
2018
- prealloc
2119
- revive
2220
- staticcheck
23-
- typecheck
2421
- unused
2522
- whitespace
2623
- wastedassign
2724
- unconvert
28-
- misspell
25+
- misspell
26+
settings:
27+
revive:
28+
rules:
29+
- name: package-comments
30+
disabled: true
31+
32+
formatters:
33+
enable:
34+
- gofmt
35+
- gofumpt
36+
- goimports
37+
settings:
38+
gofmt:
39+
rewrite-rules:
40+
- pattern: 'interface{}'
41+
replacement: 'any'

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.PHONY: init
22
init:
33
go install mvdan.cc/gofumpt@latest
4-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
4+
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
55

66
.PHONY: lint
77
lint:

message.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"net/http"
66
)
77

8-
type InterfaceMessageRequest interface{}
8+
type InterfaceMessageRequest any
99

1010
var (
1111
_ InterfaceMessageRequest = MessageRequest{}

request.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const (
3232

3333
type requestOptions struct {
3434
params url.Values
35-
body interface{}
35+
body any
3636
needEncrypt bool
3737
needAccessToken bool
3838
requestType requestType
@@ -52,7 +52,7 @@ func newRequestOptions(opts ...requestOption) *requestOptions {
5252
return args
5353
}
5454

55-
func (r *requestOptions) bodyReader(body interface{}) (io.Reader, error) {
55+
func (r *requestOptions) bodyReader(body any) (io.Reader, error) {
5656
if body == nil {
5757
return nil, nil
5858
}
@@ -71,7 +71,7 @@ func (r *requestOptions) bodyReader(body interface{}) (io.Reader, error) {
7171

7272
type requestOption func(*requestOptions)
7373

74-
func withRequestBody(body interface{}) requestOption {
74+
func withRequestBody(body any) requestOption {
7575
return func(args *requestOptions) {
7676
args.body = body
7777
}
@@ -170,12 +170,12 @@ func (c *Client) encodeRequestBody(opt *requestOptions) (io.Reader, error) {
170170
}
171171
}
172172

173-
func (c *Client) sendRequest(req *http.Request, resp interface{}, opts ...responseOption) error {
173+
func (c *Client) sendRequest(req *http.Request, resp any, opts ...responseOption) error {
174174
res, err := c.httpClient.Do(req)
175175
if err != nil {
176176
return err
177177
}
178-
defer res.Body.Close()
178+
defer res.Body.Close() // nolint:errcheck
179179

180180
if res.StatusCode != http.StatusOK {
181181
return ErrUnexpectedResponseCode

response.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func withResponseDecrypt() responseOption {
3333
}
3434
}
3535

36-
func (c *Client) decodeResponse(body io.Reader, resp interface{}, opts ...responseOption) error {
36+
func (c *Client) decodeResponse(body io.Reader, resp any, opts ...responseOption) error {
3737
opt := newResponseOptions(opts...)
3838

3939
if !opt.needDecrypt {
@@ -43,7 +43,7 @@ func (c *Client) decodeResponse(body io.Reader, resp interface{}, opts ...respon
4343
return c.decodeResponseWithDecrypt(body, resp, opts...)
4444
}
4545

46-
func (c *Client) decodeResponseWithDecrypt(body io.Reader, resp interface{}, _ ...responseOption) error {
46+
func (c *Client) decodeResponseWithDecrypt(body io.Reader, resp any, _ ...responseOption) error {
4747
var r Response
4848
if err := json.NewDecoder(body).Decode(&r); err != nil {
4949
return err

session.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (c *Client) UpdateSession(
7373
return
7474
}
7575

76-
type InterfaceSessionMessageRequest interface{}
76+
type InterfaceSessionMessageRequest any
7777

7878
var (
7979
_ InterfaceSessionMessageRequest = SessionMessageResponse{}

0 commit comments

Comments
 (0)