Skip to content

Commit

Permalink
move from juju/errors to pkg/errors (#7151)
Browse files Browse the repository at this point in the history
  • Loading branch information
lysu authored Sep 12, 2018
1 parent a6d3a18 commit cb03f2b
Show file tree
Hide file tree
Showing 327 changed files with 1,239 additions and 2,134 deletions.
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]]
branch = "master"
name = "github.com/pingcap/tipb"

[[constraint]]
name = "github.com/pkg/errors"
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
22 changes: 11 additions & 11 deletions 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 Expand Up @@ -93,7 +93,7 @@ func createColumnInfo(tblInfo *model.TableInfo, colInfo *model.ColumnInfo, pos *
} else if pos.Tp == ast.ColumnPositionAfter {
c := model.FindColumnInfo(cols, pos.RelativeColumn.Name.L)
if c == nil {
return nil, 0, infoschema.ErrColumnNotExists.GenByArgs(pos.RelativeColumn, tblInfo.Name)
return nil, 0, infoschema.ErrColumnNotExists.GenWithStackByArgs(pos.RelativeColumn, tblInfo.Name)
}

// Insert position is after the mentioned column.
Expand Down Expand Up @@ -139,7 +139,7 @@ func onAddColumn(d *ddlCtx, t *meta.Meta, job *model.Job) (ver int64, _ error) {
if columnInfo.State == model.StatePublic {
// We already have a column with the same column name.
job.State = model.JobStateCancelled
return ver, infoschema.ErrColumnExists.GenByArgs(col.Name)
return ver, infoschema.ErrColumnExists.GenWithStackByArgs(col.Name)
}
} else {
columnInfo, offset, err = createColumnInfo(tblInfo, col, pos)
Expand Down Expand Up @@ -189,7 +189,7 @@ func onAddColumn(d *ddlCtx, t *meta.Meta, job *model.Job) (ver int64, _ error) {
job.FinishTableJob(model.JobStateDone, model.StatePublic, ver, tblInfo)
asyncNotifyEvent(d, &util.Event{Tp: model.ActionAddColumn, TableInfo: tblInfo, ColumnInfo: columnInfo})
default:
err = ErrInvalidColumnState.Gen("invalid column state %v", columnInfo.State)
err = ErrInvalidColumnState.GenWithStack("invalid column state %v", columnInfo.State)
}

return ver, errors.Trace(err)
Expand All @@ -212,7 +212,7 @@ func onDropColumn(t *meta.Meta, job *model.Job) (ver int64, _ error) {
colInfo := model.FindColumnInfo(tblInfo.Columns, colName.L)
if colInfo == nil {
job.State = model.JobStateCancelled
return ver, ErrCantDropFieldOrKey.Gen("column %s doesn't exist", colName)
return ver, ErrCantDropFieldOrKey.GenWithStack("column %s doesn't exist", colName)
}
if err = isDroppableColumn(tblInfo, colName); err != nil {
job.State = model.JobStateCancelled
Expand Down Expand Up @@ -251,7 +251,7 @@ func onDropColumn(t *meta.Meta, job *model.Job) (ver int64, _ error) {
// Finish this job.
job.FinishTableJob(model.JobStateDone, model.StateNone, ver, tblInfo)
default:
err = ErrInvalidTableState.Gen("invalid table state %v", tblInfo.State)
err = ErrInvalidTableState.GenWithStack("invalid table state %v", tblInfo.State)
}
return ver, errors.Trace(err)
}
Expand Down Expand Up @@ -290,14 +290,14 @@ func doModifyColumn(t *meta.Meta, job *model.Job, newCol *model.ColumnInfo, oldN
oldCol := model.FindColumnInfo(tblInfo.Columns, oldName.L)
if oldCol == nil || oldCol.State != model.StatePublic {
job.State = model.JobStateCancelled
return ver, infoschema.ErrColumnNotExists.GenByArgs(oldName, tblInfo.Name)
return ver, infoschema.ErrColumnNotExists.GenWithStackByArgs(oldName, tblInfo.Name)
}
// If we want to rename the column name, we need to check whether it already exists.
if newCol.Name.L != oldName.L {
c := model.FindColumnInfo(tblInfo.Columns, newCol.Name.L)
if c != nil {
job.State = model.JobStateCancelled
return ver, infoschema.ErrColumnExists.GenByArgs(newCol.Name)
return ver, infoschema.ErrColumnExists.GenWithStackByArgs(newCol.Name)
}
}

Expand All @@ -317,13 +317,13 @@ func doModifyColumn(t *meta.Meta, job *model.Job, newCol *model.ColumnInfo, oldN
if oldName.L == pos.RelativeColumn.Name.L {
// `alter table tableName modify column b int after b` will return ver,ErrColumnNotExists.
job.State = model.JobStateCancelled
return ver, infoschema.ErrColumnNotExists.GenByArgs(oldName, tblInfo.Name)
return ver, infoschema.ErrColumnNotExists.GenWithStackByArgs(oldName, tblInfo.Name)
}

relative := model.FindColumnInfo(tblInfo.Columns, pos.RelativeColumn.Name.L)
if relative == nil || relative.State != model.StatePublic {
job.State = model.JobStateCancelled
return ver, infoschema.ErrColumnNotExists.GenByArgs(pos.RelativeColumn, tblInfo.Name)
return ver, infoschema.ErrColumnNotExists.GenWithStackByArgs(pos.RelativeColumn, tblInfo.Name)
}

if relative.Offset < oldPos {
Expand Down Expand Up @@ -387,7 +387,7 @@ func updateColumn(t *meta.Meta, job *model.Job, newCol *model.ColumnInfo, oldCol
oldCol := model.FindColumnInfo(tblInfo.Columns, oldColName.L)
if oldCol == nil || oldCol.State != model.StatePublic {
job.State = model.JobStateCancelled
return ver, infoschema.ErrColumnNotExists.GenByArgs(newCol.Name, tblInfo.Name)
return ver, infoschema.ErrColumnNotExists.GenWithStackByArgs(newCol.Name, tblInfo.Name)
}
*oldCol = *newCol

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
8 changes: 4 additions & 4 deletions 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 Expand Up @@ -912,11 +912,11 @@ func (s *testColumnSuite) TestModifyColumn(c *C) {
err error
}{
{"int", "bigint", nil},
{"int", "int unsigned", errUnsupportedModifyColumn.GenByArgs("length 10 is less than origin 11")},
{"int", "int unsigned", errUnsupportedModifyColumn.GenWithStackByArgs("length 10 is less than origin 11")},
{"varchar(10)", "text", nil},
{"varbinary(10)", "blob", nil},
{"text", "blob", errUnsupportedModifyColumn.GenByArgs("charset binary not match origin utf8")},
{"varchar(10)", "varchar(8)", errUnsupportedModifyColumn.GenByArgs("length 8 is less than origin 10")},
{"text", "blob", errUnsupportedModifyColumn.GenWithStackByArgs("charset binary not match origin utf8")},
{"varchar(10)", "varchar(8)", errUnsupportedModifyColumn.GenWithStackByArgs("length 8 is less than origin 10")},
{"varchar(10)", "varchar(11)", nil},
{"varchar(10) character set utf8 collate utf8_bin", "varchar(10) character set utf8", nil},
}
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
Loading

0 comments on commit cb03f2b

Please sign in to comment.