Skip to content

Commit a842163

Browse files
committed
fix all lint issue
1 parent d542479 commit a842163

33 files changed

Lines changed: 67 additions & 80 deletions

File tree

‎.github/workflows/pr_build_and_test.yaml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ jobs:
3636
steps:
3737
- name: Check out code
3838
uses: actions/checkout@v4
39+
with:
40+
fetch-depth: 0
3941

4042
- name: Setup Go environment
4143
uses: actions/setup-go@v6

‎cmd/storage-consumer/main.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ package main
1515

1616
import (
1717
"context"
18-
"errors"
1918
"flag"
2019
"net/http"
2120
"net/url"
@@ -27,6 +26,7 @@ import (
2726

2827
"github.com/pingcap/log"
2928
"github.com/pingcap/ticdc/pkg/config"
29+
"github.com/pingcap/ticdc/pkg/errors"
3030
"github.com/pingcap/ticdc/pkg/logger"
3131
"github.com/pingcap/ticdc/pkg/version"
3232
"go.uber.org/zap"

‎coordinator/coordinator_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package coordinator
1616
import (
1717
"context"
1818
"encoding/json"
19-
"errors"
2019
"flag"
2120
"fmt"
2221
"net"
@@ -36,6 +35,7 @@ import (
3635
"github.com/pingcap/ticdc/pkg/common"
3736
appcontext "github.com/pingcap/ticdc/pkg/common/context"
3837
"github.com/pingcap/ticdc/pkg/config"
38+
"github.com/pingcap/ticdc/pkg/errors"
3939
"github.com/pingcap/ticdc/pkg/etcd"
4040
"github.com/pingcap/ticdc/pkg/eventservice"
4141
"github.com/pingcap/ticdc/pkg/messaging"

‎logservice/logpuller/region_request_worker.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ package logpuller
1515

1616
import (
1717
"context"
18-
stderrors "errors"
1918
"sync"
2019
"sync/atomic"
2120
"time"
@@ -106,7 +105,7 @@ func newRegionRequestWorker(
106105
}
107106
var regionErr error
108107
if err := version.CheckStoreVersion(ctx, worker.client.pd); err != nil {
109-
if stderrors.Is(errors.Cause(err), context.Canceled) {
108+
if cerror.Is(errors.Cause(err), context.Canceled) {
110109
return nil
111110
}
112111
log.Error("event feed check store version fails",

‎logservice/logpuller/subscription_client.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ package logpuller
1515

1616
import (
1717
"context"
18-
stderrors "errors"
1918
"sync"
2019
"sync/atomic"
2120
"time"
@@ -846,7 +845,7 @@ func (s *subscriptionClient) handleErrors(ctx context.Context) error {
846845
func (s *subscriptionClient) doHandleError(ctx context.Context, errInfo regionErrorInfo) error {
847846
err := errors.Cause(errInfo.err)
848847
var rcErr *requestCancelledErr
849-
if !stderrors.As(err, &rcErr) {
848+
if !cerror.As(err, &rcErr) {
850849
log.Debug("cdc region error",
851850
zap.Uint64("subscriptionID", uint64(errInfo.subscribedSpan.subID)),
852851
zap.Uint64("regionID", errInfo.verID.GetID()),

‎logservice/schemastore/disk_format.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"bytes"
1818
"encoding/binary"
1919
"encoding/json"
20-
"errors"
2120
"math"
2221
"strings"
2322
"time"
@@ -26,6 +25,7 @@ import (
2625
"github.com/pingcap/log"
2726
"github.com/pingcap/ticdc/pkg/common"
2827
commonEvent "github.com/pingcap/ticdc/pkg/common/event"
28+
"github.com/pingcap/ticdc/pkg/errors"
2929
"github.com/pingcap/ticdc/pkg/filter"
3030
"github.com/pingcap/tidb/pkg/kv"
3131
"github.com/pingcap/tidb/pkg/meta/model"

‎logservice/schemastore/multi_version_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
package schemastore
1515

1616
import (
17-
"errors"
1817
"testing"
1918

2019
"github.com/pingcap/ticdc/pkg/common"
20+
"github.com/pingcap/ticdc/pkg/errors"
2121
"github.com/stretchr/testify/require"
2222
)
2323

‎logservice/schemastore/persist_storage_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
package schemastore
1515

1616
import (
17-
"errors"
1817
"fmt"
1918
"math"
2019
"os"
@@ -26,6 +25,7 @@ import (
2625
"github.com/pingcap/log"
2726
"github.com/pingcap/ticdc/pkg/common"
2827
commonEvent "github.com/pingcap/ticdc/pkg/common/event"
28+
"github.com/pingcap/ticdc/pkg/errors"
2929
"github.com/pingcap/ticdc/pkg/filter"
3030
"github.com/pingcap/tidb/pkg/meta/model"
3131
"github.com/pingcap/tidb/pkg/parser/ast"

‎pkg/etcd/client.go‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package etcd
1616
import (
1717
"context"
1818
"crypto/tls"
19-
stderrors "errors"
2019
"fmt"
2120
"sync"
2221
"time"
@@ -141,7 +140,7 @@ func retryRPC(rpcName string, metric prometheus.Counter, etcdRPC func() error) e
141140
// 16s = \sum_{n=0}^{6} 0.5*1.5^n
142141
return retry.Do(context.Background(), func() error {
143142
err := etcdRPC()
144-
if err != nil && !stderrors.Is(errors.Cause(err), context.Canceled) {
143+
if err != nil && !cerror.Is(errors.Cause(err), context.Canceled) {
145144
log.Warn("etcd RPC failed", zap.String("RPC", rpcName), zap.Error(err))
146145
}
147146
if metric != nil {
@@ -353,7 +352,7 @@ func isRetryableError(rpcName string) retry.IsRetryable {
353352
switch rpcName {
354353
case EtcdRevoke:
355354
var etcdErr v3rpc.EtcdError
356-
if stderrors.As(err, &etcdErr) && etcdErr.Code() == codes.NotFound {
355+
if cerror.As(err, &etcdErr) && etcdErr.Code() == codes.NotFound {
357356
// It means the etcd lease is already expired or revoked
358357
return false
359358
}
@@ -616,5 +615,5 @@ func IsHealthy(ctx context.Context, client *clientv3.Client) bool {
616615
_, err := client.Get(ctx, healthyPath)
617616
// permission denied is OK since proposal goes through consensus to get it
618617
// See: https://github.com/etcd-io/etcd/blob/85b640cee793e25f3837c47200089d14a8392dc7/etcdctl/ctlv3/command/ep_command.go#L124
619-
return err == nil || stderrors.Is(err, rpctypes.ErrPermissionDenied)
618+
return err == nil || cerror.Is(err, rpctypes.ErrPermissionDenied)
620619
}

‎pkg/logger/log.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package logger
1616
import (
1717
"bytes"
1818
"context"
19-
stderrors "errors"
2019
"io"
2120
"os"
2221
"strconv"
@@ -27,6 +26,7 @@ import (
2726
"github.com/go-sql-driver/mysql"
2827
"github.com/pingcap/errors"
2928
"github.com/pingcap/log"
29+
cerror "github.com/pingcap/ticdc/pkg/errors"
3030
"go.uber.org/zap"
3131
"go.uber.org/zap/zapcore"
3232
"google.golang.org/grpc/grpclog"
@@ -233,7 +233,7 @@ func initOptionalComponent(op *loggerOp, cfg *Config) error {
233233
func ZapErrorFilter(err error, filterErrors ...error) zap.Field {
234234
cause := errors.Cause(err)
235235
for _, ferr := range filterErrors {
236-
if stderrors.Is(cause, ferr) {
236+
if cerror.Is(cause, ferr) {
237237
return zap.Error(nil)
238238
}
239239
}
@@ -335,7 +335,7 @@ func ErrorFilterContextCanceled(logger *zap.Logger, msg string, fields ...zap.Fi
335335
}
336336
case zapcore.ErrorType:
337337
err, ok := field.Interface.(error)
338-
if ok && stderrors.Is(errors.Cause(err), context.Canceled) {
338+
if ok && cerror.Is(errors.Cause(err), context.Canceled) {
339339
return
340340
}
341341
}

0 commit comments

Comments
 (0)