Skip to content

Commit

Permalink
*: unify error handling by removing pkg/errors (#2644) (#2806)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
ti-srebot authored Sep 7, 2020
1 parent 30e7167 commit d22b12a
Show file tree
Hide file tree
Showing 65 changed files with 68 additions and 72 deletions.
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import (
"time"

"github.com/opentracing/opentracing-go"
"github.com/pingcap/errors"
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/pingcap/kvproto/pkg/pdpb"
"github.com/pingcap/log"
"github.com/pkg/errors"
"github.com/tikv/pd/pkg/errs"
"go.uber.org/zap"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/pd-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"syscall"

grpcprometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pkg/errors"
"github.com/tikv/pd/pkg/dashboard"
"github.com/tikv/pd/pkg/logutil"
"github.com/tikv/pd/pkg/metricutil"
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ require (
github.com/pingcap/failpoint v0.0.0-20191029060244-12f4ac2fd11d
github.com/pingcap/kvproto v0.0.0-20200818080353-7aaed8998596
github.com/pingcap/log v0.0.0-20200511115504-543df19646ad
github.com/pingcap/sysutil v0.0.0-20200408114249-ed3bd6f7fdb1
github.com/pkg/errors v0.9.1
github.com/pingcap/sysutil v0.0.0-20200715082929-4c47bcac246a
github.com/prometheus/client_golang v1.0.0
github.com/sasha-s/go-deadlock v0.2.0
github.com/sirupsen/logrus v1.2.0
Expand Down
5 changes: 2 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,9 @@ github.com/pingcap/log v0.0.0-20200117041106-d28c14d3b1cd/go.mod h1:4rbK1p9ILyIf
github.com/pingcap/log v0.0.0-20200511115504-543df19646ad h1:SveG82rmu/GFxYanffxsSF503SiQV+2JLnWEiGiF+Tc=
github.com/pingcap/log v0.0.0-20200511115504-543df19646ad/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8=
github.com/pingcap/sysutil v0.0.0-20200206130906-2bfa6dc40bcd/go.mod h1:EB/852NMQ+aRKioCpToQ94Wl7fktV+FNnxf3CX/TTXI=
github.com/pingcap/sysutil v0.0.0-20200408114249-ed3bd6f7fdb1 h1:PI8YpTl45F8ilNkrPtT4IdbcZB1SCEa+gK/U5GJYl3E=
github.com/pingcap/sysutil v0.0.0-20200408114249-ed3bd6f7fdb1/go.mod h1:EB/852NMQ+aRKioCpToQ94Wl7fktV+FNnxf3CX/TTXI=
github.com/pingcap/sysutil v0.0.0-20200715082929-4c47bcac246a h1:i2RElJ2aykSqZKeY+3SK18NHhajil8cQdG77wHe+P1Y=
github.com/pingcap/sysutil v0.0.0-20200715082929-4c47bcac246a/go.mod h1:EB/852NMQ+aRKioCpToQ94Wl7fktV+FNnxf3CX/TTXI=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down
2 changes: 1 addition & 1 deletion pkg/apiutil/apiutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"strconv"

"github.com/pingcap/errcode"
"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pkg/errors"
"github.com/unrolled/render"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/codec/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"bytes"
"encoding/binary"

"github.com/pkg/errors"
"github.com/pingcap/errors"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion pkg/etcdutil/etcdutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"time"

"github.com/gogo/protobuf/proto"
"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pkg/errors"
"go.etcd.io/etcd/clientv3"
"go.etcd.io/etcd/etcdserver"
"go.etcd.io/etcd/pkg/types"
Expand Down
2 changes: 1 addition & 1 deletion pkg/grpcutil/grpcutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"crypto/tls"
"net/url"

"github.com/pkg/errors"
"github.com/pingcap/errors"
"go.etcd.io/etcd/pkg/transport"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
Expand Down
2 changes: 1 addition & 1 deletion pkg/logutil/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"sync"

"github.com/coreos/pkg/capnslog"
"github.com/pingcap/errors"
zaplog "github.com/pingcap/log"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"go.etcd.io/etcd/raft"
"go.uber.org/zap"
Expand Down
2 changes: 1 addition & 1 deletion pkg/typeutil/convension.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package typeutil
import (
"encoding/binary"

"github.com/pkg/errors"
"github.com/pingcap/errors"
)

// BytesToUint64 converts a byte slice to uint64.
Expand Down
2 changes: 1 addition & 1 deletion pkg/typeutil/duration.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"strconv"
"time"

"github.com/pkg/errors"
"github.com/pingcap/errors"
)

// Duration is a wrapper of time.Duration for TOML and JSON.
Expand Down
2 changes: 1 addition & 1 deletion pkg/typeutil/size.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"strconv"

"github.com/docker/go-units"
"github.com/pkg/errors"
"github.com/pingcap/errors"
)

// ByteSize is a retype uint64 for TOML and JSON.
Expand Down
2 changes: 1 addition & 1 deletion pkg/typeutil/string_slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"strconv"
"strings"

"github.com/pkg/errors"
"github.com/pingcap/errors"
)

// StringSlice is more friendly to json encode/decode
Expand Down
2 changes: 1 addition & 1 deletion plugin/scheduler_example/evict_leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"sync"

"github.com/gorilla/mux"
"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pkg/errors"
"github.com/tikv/pd/pkg/apiutil"
"github.com/tikv/pd/server/core"
"github.com/tikv/pd/server/schedule"
Expand Down
2 changes: 1 addition & 1 deletion server/api/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

"github.com/gorilla/mux"
"github.com/pingcap/errcode"
"github.com/pkg/errors"
"github.com/pingcap/errors"
"github.com/tikv/pd/pkg/apiutil"
"github.com/tikv/pd/server"
"github.com/unrolled/render"
Expand Down
2 changes: 1 addition & 1 deletion server/api/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"strings"

"github.com/pingcap/errcode"
"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pkg/errors"
"github.com/tikv/pd/pkg/apiutil"
"github.com/tikv/pd/pkg/logutil"
"github.com/tikv/pd/server"
Expand Down
2 changes: 1 addition & 1 deletion server/api/diagnose.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"net/http"
"time"

"github.com/pingcap/errors"
"github.com/pingcap/kvproto/pkg/pdpb"
"github.com/pkg/errors"
"github.com/tikv/pd/server"
"github.com/unrolled/render"
)
Expand Down
2 changes: 1 addition & 1 deletion server/api/label.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"regexp"
"strings"

"github.com/pingcap/errors"
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/pkg/errors"
"github.com/tikv/pd/server"
"github.com/unrolled/render"
)
Expand Down
2 changes: 1 addition & 1 deletion server/api/member.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"strconv"

"github.com/gorilla/mux"
"github.com/pingcap/errors"
"github.com/pingcap/kvproto/pkg/pdpb"
"github.com/pingcap/log"
"github.com/pkg/errors"
"github.com/tikv/pd/pkg/apiutil"
"github.com/tikv/pd/pkg/etcdutil"
"github.com/tikv/pd/server"
Expand Down
2 changes: 1 addition & 1 deletion server/api/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"strconv"

"github.com/gorilla/mux"
"github.com/pkg/errors"
"github.com/pingcap/errors"
"github.com/tikv/pd/pkg/apiutil"
"github.com/tikv/pd/pkg/codec"
"github.com/tikv/pd/pkg/keyutil"
Expand Down
2 changes: 1 addition & 1 deletion server/api/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (

"github.com/gorilla/mux"
"github.com/pingcap/errcode"
"github.com/pingcap/errors"
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/pkg/errors"
"github.com/tikv/pd/pkg/apiutil"
"github.com/tikv/pd/pkg/typeutil"
"github.com/tikv/pd/server"
Expand Down
2 changes: 1 addition & 1 deletion server/api/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"net/http"
"net/url"

"github.com/pkg/errors"
"github.com/pingcap/errors"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion server/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ import (
"github.com/coreos/go-semver/semver"
"github.com/gogo/protobuf/proto"
"github.com/pingcap/errcode"
"github.com/pingcap/errors"
"github.com/pingcap/failpoint"
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/pingcap/kvproto/pkg/pdpb"
"github.com/pingcap/kvproto/pkg/replication_modepb"
"github.com/pingcap/log"
"github.com/pkg/errors"
"github.com/tikv/pd/pkg/cache"
"github.com/tikv/pd/pkg/component"
"github.com/tikv/pd/pkg/etcdutil"
Expand Down
2 changes: 1 addition & 1 deletion server/cluster/cluster_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import (
"bytes"

"github.com/gogo/protobuf/proto"
"github.com/pingcap/errors"
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/pingcap/kvproto/pkg/pdpb"
"github.com/pingcap/log"
"github.com/pkg/errors"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/server/core"
"github.com/tikv/pd/server/schedule"
Expand Down
2 changes: 1 addition & 1 deletion server/cluster/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ package cluster

import (
"github.com/coreos/go-semver/semver"
"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pkg/errors"
"go.uber.org/zap"
)

Expand Down
2 changes: 1 addition & 1 deletion server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ import (

"github.com/BurntSushi/toml"
"github.com/coreos/go-semver/semver"
"github.com/pingcap/errors"
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/pingcap/log"
"github.com/pkg/errors"
"go.etcd.io/etcd/embed"
"go.etcd.io/etcd/pkg/transport"
"go.uber.org/zap"
Expand Down
2 changes: 1 addition & 1 deletion server/config/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"net/url"
"regexp"

"github.com/pingcap/errors"
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/pkg/errors"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion server/core/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"net/http"

"github.com/pingcap/errcode"
"github.com/pingcap/errors"
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/pkg/errors"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion server/core/region_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import (
"sync"
"time"

"github.com/pingcap/errors"
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/pingcap/log"
"github.com/pkg/errors"
"github.com/tikv/pd/server/kv"
"go.uber.org/zap"
)
Expand Down
2 changes: 1 addition & 1 deletion server/core/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
"time"

"github.com/gogo/protobuf/proto"
"github.com/pingcap/errors"
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/pkg/errors"
"github.com/tikv/pd/server/kv"
"go.etcd.io/etcd/clientv3"
)
Expand Down
2 changes: 1 addition & 1 deletion server/core/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"time"

. "github.com/pingcap/check"
"github.com/pingcap/errors"
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/pkg/errors"
"github.com/tikv/pd/server/kv"
)

Expand Down
2 changes: 1 addition & 1 deletion server/grpc_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import (
"sync/atomic"
"time"

"github.com/pingcap/errors"
"github.com/pingcap/failpoint"
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/pingcap/kvproto/pkg/pdpb"
"github.com/pingcap/log"
"github.com/pkg/errors"
"github.com/tikv/pd/server/cluster"
"github.com/tikv/pd/server/core"
"go.uber.org/zap"
Expand Down
2 changes: 1 addition & 1 deletion server/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import (
"time"

"github.com/pingcap/errcode"
"github.com/pingcap/errors"
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/pingcap/kvproto/pkg/pdpb"
"github.com/pingcap/log"
"github.com/pkg/errors"
"github.com/tikv/pd/server/cluster"
"github.com/tikv/pd/server/config"
"github.com/tikv/pd/server/core"
Expand Down
2 changes: 1 addition & 1 deletion server/id/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"path"
"sync"

"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pkg/errors"
"github.com/tikv/pd/pkg/etcdutil"
"github.com/tikv/pd/pkg/typeutil"
"github.com/tikv/pd/server/kv"
Expand Down
2 changes: 1 addition & 1 deletion server/join/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
"strings"
"time"

"github.com/pingcap/errors"
"github.com/pingcap/failpoint"
"github.com/pingcap/log"
"github.com/pkg/errors"
"github.com/tikv/pd/pkg/etcdutil"
"github.com/tikv/pd/server/config"
"go.etcd.io/etcd/clientv3"
Expand Down
2 changes: 1 addition & 1 deletion server/kv/etcd_kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"strings"
"time"

"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pkg/errors"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/etcdutil"
"go.etcd.io/etcd/clientv3"
Expand Down
2 changes: 1 addition & 1 deletion server/kv/levedb_kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ package kv

import (
"github.com/gogo/protobuf/proto"
"github.com/pingcap/errors"
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/pkg/errors"
"github.com/syndtr/goleveldb/leveldb"
"github.com/syndtr/goleveldb/leveldb/util"
)
Expand Down
2 changes: 1 addition & 1 deletion server/member/leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import (
"sync/atomic"
"time"

"github.com/pingcap/errors"
"github.com/pingcap/failpoint"
"github.com/pingcap/kvproto/pkg/pdpb"
"github.com/pingcap/log"
"github.com/pkg/errors"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/etcdutil"
"github.com/tikv/pd/server/config"
Expand Down
Loading

0 comments on commit d22b12a

Please sign in to comment.