Skip to content

Commit e63537b

Browse files
authored
[to #371] chore: Upgrade golangci-lint to v1.55.2 (#373)
* upgrade golangci v1.55.2 Signed-off-by: Ping Yu <[email protected]> * fix lint error Signed-off-by: Ping Yu <[email protected]> --------- Signed-off-by: Ping Yu <[email protected]>
1 parent 1736954 commit e63537b

File tree

8 files changed

+18
-18
lines changed

8 files changed

+18
-18
lines changed

.golangci.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ linters-settings:
4949
- name: unreachable-code
5050

5151
depguard:
52-
list-type: blacklist
53-
include-go-root: false
54-
packages:
55-
- log
56-
- github.com/juju/errors
57-
packages-with-error-message:
58-
# specify an error message to output when a blacklisted package is used
59-
- log: "logging is allowed only by pingcap/log"
60-
- github.com/juju/errors: "error handling is allowed only by pingcap/errors"
52+
rules:
53+
main:
54+
list-mode: lax # everything is allowed unless it is denied.
55+
deny:
56+
- pkg: "log"
57+
desc: logging is allowed only by pingcap/log
58+
- pkg: "github.com/juju/errors"
59+
desc: error handling is allowed only by pingcap/errors
60+
6161
staticcheck:
6262
checks: ["S1002","S1004","S1007","S1009","S1010","S1012","S1019","S1020","S1021","S1024","S1030","SA2*","SA3*","SA4009","SA5*","SA6000","SA6001","SA6005", "-SA2002"]
6363
stylecheck:

br/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ failpoint/disable: tools/bin/failpoint-ctl
8686
find `pwd` -type d | grep -vE "(\.git|tools)" | xargs tools/bin/failpoint-ctl disable
8787

8888
tools/bin/golangci-lint:
89-
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./tools/bin v1.52.2
89+
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./tools/bin v1.55.2
9090

9191
tools/bin/failpoint-ctl: tools/check/go.mod
9292
cd tools/check && $(GO) build -o ../bin/failpoint-ctl github.com/pingcap/failpoint/failpoint-ctl

br/pkg/backup/client.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@ func (bc *Client) BackupRanges(
250250
progressCallBack func(ProgressUnit),
251251
) error {
252252
init := time.Now()
253-
defer log.Info("Backup Ranges", zap.Duration("take", time.Since(init)))
253+
defer func() {
254+
log.Info("Backup Ranges", zap.Duration("take", time.Since(init)))
255+
}()
254256

255257
if span := opentracing.SpanFromContext(ctx); span != nil && span.Tracer() != nil {
256258
span1 := span.Tracer().StartSpan("Client.BackupRanges", opentracing.ChildOf(span.Context()))

br/pkg/backup/client_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"time"
1010

1111
"github.com/jarcoal/httpmock"
12-
. "github.com/pingcap/check"
12+
. "github.com/pingcap/check" // nolint:revive
1313
backuppb "github.com/pingcap/kvproto/pkg/brpb"
1414
"github.com/pingcap/kvproto/pkg/errorpb"
1515
"github.com/pingcap/kvproto/pkg/kvrpcpb"

br/pkg/storage/s3_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
backuppb "github.com/pingcap/kvproto/pkg/brpb"
2222
"github.com/stretchr/testify/require"
2323
"github.com/tikv/migration/br/pkg/mock"
24-
. "github.com/tikv/migration/br/pkg/storage"
24+
. "github.com/tikv/migration/br/pkg/storage" // nolint:revive
2525
)
2626

2727
type s3Suite struct {

cdc/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ tools/bin/goveralls: tools/check/go.mod
202202
cd tools/check && $(GO) build -mod=mod -o ../bin/goveralls github.com/mattn/goveralls
203203

204204
tools/bin/golangci-lint: tools/check/go.mod
205-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b tools/bin v1.51.1
205+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b tools/bin v1.55.2
206206

207207
tools/bin/mockgen: tools/check/go.mod
208208
cd tools/check && $(GO) build -mod=mod -o ../bin/mockgen github.com/golang/mock/mockgen

cdc/cdc/model/kv.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,8 @@ func (e *RegionFeedEvent) GetValue() interface{} {
5454
return e.Val
5555
} else if e.Resolved != nil {
5656
return e.Resolved
57-
} else {
58-
return nil
5957
}
58+
return nil
6059
}
6160

6261
// ResolvedSpan guarantees all the KV value event

cdc/pkg/fsutil/filelock.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ func (fl *FileLock) IsLocked() (bool, error) {
7979
return true, nil
8080
} else if err != nil {
8181
return false, errors.Trace(err)
82-
} else {
83-
return false, nil
8482
}
83+
return false, nil
8584
}

0 commit comments

Comments
 (0)