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

move from juju/errors to pkg/errors #7151

Merged
merged 6 commits into from
Sep 12, 2018
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 7 additions & 13 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,9 @@ required = ["github.com/golang/protobuf/jsonpb"]
[[constraint]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to move the vendor change to another pr.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recommand review by commits, 1st comment add vendor, 2nd replace import and remove vendor, 3rd fix some testcase.

branch = "master"
name = "github.com/pingcap/tipb"

[[constraint]]
name = "github.com/pkg/errors"
zz-jason marked this conversation as resolved.
Show resolved Hide resolved
version = "0.9.0"
source = "https://github.com/pingcap/errors.git"

2 changes: 1 addition & 1 deletion cmd/benchfilesort/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ import (
"runtime/pprof"
"time"

"github.com/juju/errors"
"github.com/pingcap/tidb/sessionctx/stmtctx"
"github.com/pingcap/tidb/terror"
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/util/codec"
"github.com/pingcap/tidb/util/filesort"
"github.com/pingcap/tidb/util/logutil"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/benchkv/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import (

_ "github.com/go-sql-driver/mysql"

"github.com/juju/errors"
"github.com/pingcap/tidb/kv"
"github.com/pingcap/tidb/store/tikv"
"github.com/pingcap/tidb/terror"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
Expand Down
2 changes: 1 addition & 1 deletion cmd/benchraw/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import (
"sync"
"time"

"github.com/juju/errors"
"github.com/pingcap/tidb/config"
"github.com/pingcap/tidb/store/tikv"
"github.com/pingcap/tidb/terror"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/explaintest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ import (

"flag"
"github.com/go-sql-driver/mysql"
"github.com/juju/errors"
"github.com/pingcap/tidb/ast"
"github.com/pingcap/tidb/session"
"github.com/pingcap/tidb/sessionctx"
"github.com/pingcap/tidb/util/logutil"
"github.com/pingcap/tidb/util/mock"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"time"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/importer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"fmt"

"github.com/BurntSushi/toml"
"github.com/juju/errors"
"github.com/pkg/errors"
)

// NewConfig creates a new config.
Expand Down
2 changes: 1 addition & 1 deletion cmd/importer/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"strings"

_ "github.com/go-sql-driver/mysql"
"github.com/juju/errors"
"github.com/pingcap/tidb/mysql"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/importer/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"fmt"
"time"

"github.com/juju/errors"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/importer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"flag"
"os"

"github.com/juju/errors"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/importer/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ import (
"strconv"
"strings"

"github.com/juju/errors"
"github.com/pingcap/tidb/ast"
"github.com/pingcap/tidb/ddl"
"github.com/pingcap/tidb/model"
"github.com/pingcap/tidb/parser"
_ "github.com/pingcap/tidb/plan"
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/util/mock"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/importer/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import (
"math/rand"
"time"

"github.com/juju/errors"
"github.com/pingcap/tidb/model"
stats "github.com/pingcap/tidb/statistics"
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/util/chunk"
"github.com/pingcap/tidb/util/codec"
"github.com/pingcap/tidb/util/mock"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)

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

"github.com/BurntSushi/toml"
"github.com/juju/errors"
"github.com/pingcap/tidb/util/logutil"
"github.com/pkg/errors"
tracing "github.com/uber/jaeger-client-go/config"
)

Expand Down
2 changes: 1 addition & 1 deletion ddl/column.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
package ddl

import (
"github.com/juju/errors"
"github.com/pingcap/tidb/ast"
"github.com/pingcap/tidb/ddl/util"
"github.com/pingcap/tidb/infoschema"
"github.com/pingcap/tidb/meta"
"github.com/pingcap/tidb/model"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)

Expand Down
2 changes: 1 addition & 1 deletion ddl/column_change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"sync"
"time"

"github.com/juju/errors"
. "github.com/pingcap/check"
"github.com/pingcap/tidb/ast"
"github.com/pingcap/tidb/kv"
Expand All @@ -31,6 +30,7 @@ import (
"github.com/pingcap/tidb/util/mock"
"github.com/pingcap/tidb/util/testleak"
"github.com/pingcap/tidb/util/testutil"
"github.com/pkg/errors"
"golang.org/x/net/context"
)

Expand Down
2 changes: 1 addition & 1 deletion ddl/column_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"reflect"
"sync"

"github.com/juju/errors"
. "github.com/pingcap/check"
"github.com/pingcap/tidb/ast"
"github.com/pingcap/tidb/kv"
Expand All @@ -31,6 +30,7 @@ import (
"github.com/pingcap/tidb/terror"
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/util/testleak"
"github.com/pkg/errors"
"golang.org/x/net/context"
)

Expand Down
2 changes: 1 addition & 1 deletion ddl/db_change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"sync/atomic"
"time"

"github.com/juju/errors"
. "github.com/pingcap/check"
"github.com/pingcap/tidb/ast"
"github.com/pingcap/tidb/ddl"
Expand All @@ -37,6 +36,7 @@ import (
"github.com/pingcap/tidb/util/admin"
"github.com/pingcap/tidb/util/testkit"
"github.com/pingcap/tidb/util/testleak"
"github.com/pkg/errors"
"golang.org/x/net/context"
)

Expand Down
2 changes: 1 addition & 1 deletion ddl/db_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package ddl_test
import (
"fmt"

"github.com/juju/errors"
. "github.com/pingcap/check"
"github.com/pingcap/tidb/ddl"
"github.com/pingcap/tidb/domain"
Expand All @@ -31,6 +30,7 @@ import (
"github.com/pingcap/tidb/util/mock"
"github.com/pingcap/tidb/util/testkit"
"github.com/pingcap/tidb/util/testleak"
"github.com/pkg/errors"
)

var _ = Suite(&testIntegrationSuite{})
Expand Down
12 changes: 6 additions & 6 deletions ddl/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"sync"
"time"

"github.com/juju/errors"
. "github.com/pingcap/check"
"github.com/pingcap/tidb/ast"
"github.com/pingcap/tidb/ddl"
Expand All @@ -49,6 +48,7 @@ import (
"github.com/pingcap/tidb/util/testkit"
"github.com/pingcap/tidb/util/testleak"
"github.com/pingcap/tidb/util/testutil"
"github.com/pkg/errors"
"golang.org/x/net/context"
)

Expand Down Expand Up @@ -823,16 +823,16 @@ func (s *testDBSuite) TestAddIndexWithDupCols(c *C) {

s.tk.MustExec("create table test_add_index_with_dup (a int, b int)")
_, err := s.tk.Exec("create index c on test_add_index_with_dup(b, a, b)")
c.Check(err1.Equal(err), Equals, true)
c.Check(errors.Cause(err1).(*terror.Error).Equal(err), Equals, true)

_, err = s.tk.Exec("create index c on test_add_index_with_dup(b, a, B)")
c.Check(err2.Equal(err), Equals, true)
c.Check(errors.Cause(err2).(*terror.Error).Equal(err), Equals, true)

_, err = s.tk.Exec("alter table test_add_index_with_dup add index c (b, a, b)")
c.Check(err1.Equal(err), Equals, true)
c.Check(errors.Cause(err1).(*terror.Error).Equal(err), Equals, true)

_, err = s.tk.Exec("alter table test_add_index_with_dup add index c (b, a, B)")
c.Check(err2.Equal(err), Equals, true)
c.Check(errors.Cause(err2).(*terror.Error).Equal(err), Equals, true)

s.tk.MustExec("drop table test_add_index_with_dup")
}
Expand All @@ -856,7 +856,7 @@ func (s *testDBSuite) TestIssue6101(c *C) {
s.tk.MustExec("use " + s.schemaName)
s.tk.MustExec("create table t1 (quantity decimal(2) unsigned);")
_, err := s.tk.Exec("insert into t1 values (500), (-500), (~0), (-1);")
terr := errors.Trace(err).(*errors.Err).Cause().(*terror.Error)
terr := errors.Cause(errors.Trace(err)).(*terror.Error)
c.Assert(terr.Code(), Equals, terror.ErrCode(tmysql.ErrWarnDataOutOfRange))
s.tk.MustExec("drop table t1")

Expand Down
2 changes: 1 addition & 1 deletion ddl/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"time"

"github.com/coreos/etcd/clientv3"
"github.com/juju/errors"
"github.com/ngaut/pools"
"github.com/pingcap/tidb/ast"
"github.com/pingcap/tidb/ddl/util"
Expand All @@ -39,6 +38,7 @@ import (
"github.com/pingcap/tidb/sessionctx/variable"
"github.com/pingcap/tidb/table"
"github.com/pingcap/tidb/terror"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"github.com/twinj/uuid"
"golang.org/x/net/context"
Expand Down
2 changes: 1 addition & 1 deletion ddl/ddl_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"time"

"github.com/cznic/mathutil"
"github.com/juju/errors"
"github.com/pingcap/tidb/ast"
"github.com/pingcap/tidb/expression"
"github.com/pingcap/tidb/infoschema"
Expand All @@ -36,6 +35,7 @@ import (
"github.com/pingcap/tidb/table"
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/util/charset"
"github.com/pkg/errors"
)

func (d *ddl) CreateSchema(ctx sessionctx.Context, schema model.CIStr, charsetInfo *ast.CharsetOpt) (err error) {
Expand Down
2 changes: 1 addition & 1 deletion ddl/ddl_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"sync/atomic"
"time"

"github.com/juju/errors"
"github.com/ngaut/pools"
"github.com/pingcap/tidb/kv"
"github.com/pingcap/tidb/meta"
Expand All @@ -29,6 +28,7 @@ import (
"github.com/pingcap/tidb/sessionctx/binloginfo"
"github.com/pingcap/tidb/terror"
"github.com/pingcap/tidb/util"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
)
Expand Down
2 changes: 1 addition & 1 deletion ddl/ddl_worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"sync"
"time"

"github.com/juju/errors"
. "github.com/pingcap/check"
"github.com/pingcap/tidb/ast"
"github.com/pingcap/tidb/kv"
Expand All @@ -30,6 +29,7 @@ import (
"github.com/pingcap/tidb/util/mock"
"github.com/pingcap/tidb/util/sqlexec"
"github.com/pingcap/tidb/util/testleak"
"github.com/pkg/errors"
"golang.org/x/net/context"
)

Expand Down
Loading