Skip to content

Commit 1ce0df4

Browse files
authored
Merge pull request #331 from shuLhan/master
all: replace "pborman/uuid" with "google/uuid"
2 parents 172ffee + 415fb3a commit 1ce0df4

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

broker/http_broker.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"sync"
1919
"time"
2020

21+
"github.com/google/uuid"
2122
"github.com/micro/go-log"
2223
"github.com/micro/go-micro/broker/codec/json"
2324
merr "github.com/micro/go-micro/errors"
@@ -26,7 +27,6 @@ import (
2627
maddr "github.com/micro/util/go/lib/addr"
2728
mnet "github.com/micro/util/go/lib/net"
2829
mls "github.com/micro/util/go/lib/tls"
29-
"github.com/pborman/uuid"
3030
)
3131

3232
// HTTP Broker is a point to point async broker
@@ -116,7 +116,7 @@ func newHttpBroker(opts ...Option) Broker {
116116
}
117117

118118
h := &httpBroker{
119-
id: "broker-" + uuid.NewUUID().String(),
119+
id: "broker-" + uuid.New().String(),
120120
address: addr,
121121
opts: options,
122122
r: reg,
@@ -413,7 +413,7 @@ func (h *httpBroker) Init(opts ...Option) error {
413413
}
414414

415415
if len(h.id) == 0 {
416-
h.id = "broker-" + uuid.NewUUID().String()
416+
h.id = "broker-" + uuid.New().String()
417417
}
418418

419419
// get registry
@@ -520,7 +520,7 @@ func (h *httpBroker) Subscribe(topic string, handler Handler, opts ...SubscribeO
520520
}
521521

522522
// create unique id
523-
id := h.id + "." + uuid.NewUUID().String()
523+
id := h.id + "." + uuid.New().String()
524524

525525
var secure bool
526526

broker/http_broker_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import (
55
"testing"
66
"time"
77

8+
"github.com/google/uuid"
89
"github.com/micro/go-micro/registry/mock"
9-
"github.com/pborman/uuid"
1010
)
1111

1212
func sub(be *testing.B, c int) {
1313
be.StopTimer()
1414
m := mock.NewRegistry()
1515
b := NewBroker(Registry(m))
16-
topic := uuid.NewUUID().String()
16+
topic := uuid.New().String()
1717

1818
if err := b.Init(); err != nil {
1919
be.Fatalf("Unexpected init error: %v", err)
@@ -72,7 +72,7 @@ func pub(be *testing.B, c int) {
7272
be.StopTimer()
7373
m := mock.NewRegistry()
7474
b := NewBroker(Registry(m))
75-
topic := uuid.NewUUID().String()
75+
topic := uuid.New().String()
7676

7777
if err := b.Init(); err != nil {
7878
be.Fatalf("Unexpected init error: %v", err)

broker/mock/mock.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"errors"
55
"sync"
66

7+
"github.com/google/uuid"
78
"github.com/micro/go-micro/broker"
8-
"github.com/pborman/uuid"
99
)
1010

1111
type mockBroker struct {
@@ -112,7 +112,7 @@ func (m *mockBroker) Subscribe(topic string, handler broker.Handler, opts ...bro
112112

113113
sub := &mockSubscriber{
114114
exit: make(chan bool, 1),
115-
id: uuid.NewUUID().String(),
115+
id: uuid.New().String(),
116116
topic: topic,
117117
handler: handler,
118118
opts: options,

server/mock/mock.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"errors"
55
"sync"
66

7+
"github.com/google/uuid"
78
"github.com/micro/go-micro/server"
8-
"github.com/pborman/uuid"
99
)
1010

1111
type MockServer struct {
@@ -69,7 +69,7 @@ func (m *MockServer) NewHandler(h interface{}, opts ...server.HandlerOption) ser
6969
}
7070

7171
return &MockHandler{
72-
Id: uuid.NewUUID().String(),
72+
Id: uuid.New().String(),
7373
Hdlr: h,
7474
Opts: options,
7575
}

server/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"os/signal"
88
"syscall"
99

10+
"github.com/google/uuid"
1011
"github.com/micro/go-log"
11-
"github.com/pborman/uuid"
1212
)
1313

1414
type Server interface {
@@ -63,7 +63,7 @@ var (
6363
DefaultAddress = ":0"
6464
DefaultName = "go-server"
6565
DefaultVersion = "1.0.0"
66-
DefaultId = uuid.NewUUID().String()
66+
DefaultId = uuid.New().String()
6767
DefaultServer Server = newRpcServer()
6868
)
6969

0 commit comments

Comments
 (0)