Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg,cdc: do not use log package (#3902) #3939

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,16 @@ linters:
enable:
- unconvert
- unparam
- depguard

linters-settings:
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"
2 changes: 1 addition & 1 deletion cdc/processor/pipeline/mounter.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ package pipeline

import (
"context"
"log"
"sync"
"time"

"github.com/edwingeng/deque"
"github.com/pingcap/failpoint"
"github.com/pingcap/log"
"github.com/pingcap/ticdc/cdc/model"
"github.com/pingcap/ticdc/pkg/notify"
"github.com/pingcap/ticdc/pkg/pipeline"
Expand Down
3 changes: 2 additions & 1 deletion cdc/puller/frontier/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ package frontier
import (
"bytes"
"fmt"
"log"
"math"
"strings"

_ "unsafe" // required by go:linkname

"github.com/pingcap/log"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion cdc/sink/codec/canal.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ package codec

import (
"fmt"
"log"
"strconv"
"strings"

"github.com/golang/protobuf/proto" // nolint:staticcheck
"github.com/pingcap/errors"
"github.com/pingcap/log"
mm "github.com/pingcap/parser/model"
"github.com/pingcap/parser/mysql"
parser_types "github.com/pingcap/parser/types"
Expand Down
2 changes: 1 addition & 1 deletion cdc/sink/common/flow_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
package common

import (
"log"
"sync"
"sync/atomic"

"github.com/edwingeng/deque"
"github.com/pingcap/errors"
"github.com/pingcap/log"
cerrors "github.com/pingcap/ticdc/pkg/errors"
"go.uber.org/zap"
)
Expand Down
2 changes: 1 addition & 1 deletion integration/tests/case_date_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ package tests

import (
"errors"
"log"
"time"

"github.com/pingcap/log"
"github.com/pingcap/ticdc/integration/framework"
"github.com/pingcap/ticdc/integration/framework/avro"
"github.com/pingcap/ticdc/integration/framework/canal"
Expand Down
8 changes: 3 additions & 5 deletions pkg/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@ package context

import (
"context"
"log"
"time"

"github.com/pingcap/ticdc/pkg/pdtime"

"github.com/pingcap/ticdc/pkg/version"

"github.com/pingcap/log"
"github.com/pingcap/ticdc/cdc/kv"
"github.com/pingcap/ticdc/cdc/model"
"github.com/pingcap/ticdc/pkg/config"
"github.com/pingcap/ticdc/pkg/pdtime"
"github.com/pingcap/ticdc/pkg/version"
tidbkv "github.com/pingcap/tidb/kv"
"github.com/tikv/client-go/v2/oracle"
pd "github.com/tikv/pd/client"
Expand Down
2 changes: 1 addition & 1 deletion pkg/context/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (s *contextSuite) TestThrowPanic(c *check.C) {
defer testleak.AfterTest(c)()
defer func() {
panicMsg := recover()
c.Assert(panicMsg, check.Equals, "an error has escaped, please report a bug{error 26 0 mock error}")
c.Assert(panicMsg, check.Equals, "an error has escaped, please report a bug")
}()
stdCtx := context.Background()
ctx := NewContext(stdCtx, &GlobalVars{})
Expand Down
2 changes: 1 addition & 1 deletion pkg/etcd/etcdkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
package etcd

import (
"log"
"strings"

"github.com/pingcap/log"
cerror "github.com/pingcap/ticdc/pkg/errors"
)

Expand Down
3 changes: 2 additions & 1 deletion pkg/orchestrator/util/key_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
package util

import (
"log"
"strings"

"github.com/pingcap/log"
)

// EtcdKey represents a complete key in Etcd.
Expand Down