diff --git a/.golangci.yml b/.golangci.yml index 752c9af3..845afc01 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -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: diff --git a/br/Makefile b/br/Makefile index 66f3d1d8..452fab89 100644 --- a/br/Makefile +++ b/br/Makefile @@ -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 diff --git a/cdc/Makefile b/cdc/Makefile index 80954e72..8e9b1249 100644 --- a/cdc/Makefile +++ b/cdc/Makefile @@ -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 diff --git a/cdc/cdc/model/kv.go b/cdc/cdc/model/kv.go index 57637e5e..47162bb1 100644 --- a/cdc/cdc/model/kv.go +++ b/cdc/cdc/model/kv.go @@ -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 diff --git a/cdc/pkg/fsutil/filelock.go b/cdc/pkg/fsutil/filelock.go index 8a1271f8..16d6cc44 100644 --- a/cdc/pkg/fsutil/filelock.go +++ b/cdc/pkg/fsutil/filelock.go @@ -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 }