Skip to content

Commit

Permalink
[to #371] chore: Upgrade golangci-lint to v1.55.2 (#373)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
pingyu authored Dec 4, 2023
1 parent 1736954 commit e63537b
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ linters-settings:
- name: unreachable-code

depguard:
list-type: blacklist
include-go-root: false
packages:
- log
- github.com/juju/errors
packages-with-error-message:
# specify an error message to output when a blacklisted package is used
- log: "logging is allowed only by pingcap/log"
- github.com/juju/errors: "error handling is allowed only by pingcap/errors"
rules:
main:
list-mode: lax # everything is allowed unless it is denied.
deny:
- pkg: "log"
desc: logging is allowed only by pingcap/log
- pkg: "github.com/juju/errors"
desc: error handling is allowed only by pingcap/errors

staticcheck:
checks: ["S1002","S1004","S1007","S1009","S1010","S1012","S1019","S1020","S1021","S1024","S1030","SA2*","SA3*","SA4009","SA5*","SA6000","SA6001","SA6005", "-SA2002"]
stylecheck:
Expand Down
2 changes: 1 addition & 1 deletion br/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ failpoint/disable: tools/bin/failpoint-ctl
find `pwd` -type d | grep -vE "(\.git|tools)" | xargs tools/bin/failpoint-ctl disable

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

tools/bin/failpoint-ctl: tools/check/go.mod
cd tools/check && $(GO) build -o ../bin/failpoint-ctl github.com/pingcap/failpoint/failpoint-ctl
Expand Down
4 changes: 3 additions & 1 deletion br/pkg/backup/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@ func (bc *Client) BackupRanges(
progressCallBack func(ProgressUnit),
) error {
init := time.Now()
defer log.Info("Backup Ranges", zap.Duration("take", time.Since(init)))
defer func() {
log.Info("Backup Ranges", zap.Duration("take", time.Since(init)))
}()

if span := opentracing.SpanFromContext(ctx); span != nil && span.Tracer() != nil {
span1 := span.Tracer().StartSpan("Client.BackupRanges", opentracing.ChildOf(span.Context()))
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/backup/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"time"

"github.com/jarcoal/httpmock"
. "github.com/pingcap/check"
. "github.com/pingcap/check" // nolint:revive
backuppb "github.com/pingcap/kvproto/pkg/brpb"
"github.com/pingcap/kvproto/pkg/errorpb"
"github.com/pingcap/kvproto/pkg/kvrpcpb"
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/storage/s3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
backuppb "github.com/pingcap/kvproto/pkg/brpb"
"github.com/stretchr/testify/require"
"github.com/tikv/migration/br/pkg/mock"
. "github.com/tikv/migration/br/pkg/storage"
. "github.com/tikv/migration/br/pkg/storage" // nolint:revive
)

type s3Suite struct {
Expand Down
2 changes: 1 addition & 1 deletion cdc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ tools/bin/goveralls: tools/check/go.mod
cd tools/check && $(GO) build -mod=mod -o ../bin/goveralls github.com/mattn/goveralls

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

tools/bin/mockgen: tools/check/go.mod
cd tools/check && $(GO) build -mod=mod -o ../bin/mockgen github.com/golang/mock/mockgen
Expand Down
3 changes: 1 addition & 2 deletions cdc/cdc/model/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ func (e *RegionFeedEvent) GetValue() interface{} {
return e.Val
} else if e.Resolved != nil {
return e.Resolved
} else {
return nil
}
return nil
}

// ResolvedSpan guarantees all the KV value event
Expand Down
3 changes: 1 addition & 2 deletions cdc/pkg/fsutil/filelock.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ func (fl *FileLock) IsLocked() (bool, error) {
return true, nil
} else if err != nil {
return false, errors.Trace(err)
} else {
return false, nil
}
return false, nil
}

0 comments on commit e63537b

Please sign in to comment.