Skip to content

Commit 00086da

Browse files
amyangfeisiddontang
authored andcommitted
replace juju/errors with pingcap/errors (go-mysql-org#356)
* replace juju/errors with pingcap/errors and unit test fix
1 parent 5b0548c commit 00086da

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1189
-1461
lines changed

Gopkg.lock

Lines changed: 49 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
branch = "master"
3535

3636
[[constraint]]
37-
branch = "master"
38-
name = "github.com/juju/errors"
37+
name = "github.com/pingcap/errors"
38+
version = "v0.11.0"
3939

4040
[[constraint]]
4141
name = "github.com/satori/go.uuid"

canal/canal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"sync"
1212
"time"
1313

14-
"github.com/juju/errors"
14+
"github.com/pingcap/errors"
1515
"github.com/siddontang/go-log/log"
1616
"github.com/siddontang/go-mysql/client"
1717
"github.com/siddontang/go-mysql/dump"

canal/canal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"testing"
88
"time"
99

10-
"github.com/juju/errors"
1110
. "github.com/pingcap/check"
11+
"github.com/pingcap/errors"
1212
"github.com/siddontang/go-log/log"
1313
"github.com/siddontang/go-mysql/mysql"
1414
)

canal/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"time"
77

88
"github.com/BurntSushi/toml"
9-
"github.com/juju/errors"
9+
"github.com/pingcap/errors"
1010
"github.com/siddontang/go-mysql/mysql"
1111
)
1212

canal/dump.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"strings"
88
"time"
99

10-
"github.com/juju/errors"
10+
"github.com/pingcap/errors"
1111
"github.com/shopspring/decimal"
1212
"github.com/siddontang/go-log/log"
1313
"github.com/siddontang/go-mysql/mysql"

canal/master.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func (m *masterInfo) Update(pos mysql.Position) {
2626
}
2727

2828
func (m *masterInfo) UpdateTimestamp(ts uint32) {
29-
log.Debugf("update master timestamp %s", ts)
29+
log.Debugf("update master timestamp %d", ts)
3030

3131
m.Lock()
3232
m.timestamp = ts

canal/sync.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"regexp"
66
"time"
77

8-
"github.com/juju/errors"
8+
"github.com/pingcap/errors"
99
"github.com/satori/go.uuid"
1010
"github.com/siddontang/go-log/log"
1111
"github.com/siddontang/go-mysql/mysql"

client/auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"encoding/binary"
77
"fmt"
88

9-
"github.com/juju/errors"
9+
"github.com/pingcap/errors"
1010
. "github.com/siddontang/go-mysql/mysql"
1111
"github.com/siddontang/go-mysql/packet"
1212
)

client/client_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ import (
66
"strings"
77
"testing"
88

9-
"github.com/juju/errors"
109
. "github.com/pingcap/check"
10+
"github.com/pingcap/errors"
1111
"github.com/siddontang/go-mysql/test_util/test_keys"
1212

1313
"github.com/siddontang/go-mysql/mysql"
1414
)
1515

1616
var testHost = flag.String("host", "127.0.0.1", "MySQL server host")
17+
1718
// We cover the whole range of MySQL server versions using docker-compose to bind them to different ports for testing.
1819
// MySQL is constantly updating auth plugin to make it secure:
1920
// starting from MySQL 8.0.4, a new auth plugin is introduced, causing plain password auth to fail with error:
@@ -134,9 +135,9 @@ func (s *clientTestSuite) TestConn_TLS_Certificate(c *C) {
134135
if err == nil {
135136
c.Fatal("expected error")
136137
}
137-
if !strings.Contains(errors.Details(err), "certificate is not valid for any names") &&
138-
!strings.Contains(errors.Details(err), "certificate is valid for") {
139-
c.Fatalf("expected errors for server name verification, but got unknown error: %s", errors.Details(err))
138+
if !strings.Contains(errors.ErrorStack(err), "certificate is not valid for any names") &&
139+
!strings.Contains(errors.ErrorStack(err), "certificate is valid for") {
140+
c.Fatalf("expected errors for server name verification, but got unknown error: %s", errors.ErrorStack(err))
140141
}
141142
}
142143

@@ -394,4 +395,4 @@ func (s *clientTestSuite) TestStmt_Trans(c *C) {
394395

395396
str, _ = r.GetString(0, 0)
396397
c.Assert(str, Equals, `abc`)
397-
}
398+
}

0 commit comments

Comments
 (0)