Skip to content

Commit

Permalink
Merge pull request #331 from shuLhan/master
Browse files Browse the repository at this point in the history
all: replace "pborman/uuid" with "google/uuid"
  • Loading branch information
asim authored Nov 21, 2018
2 parents 172ffee + 415fb3a commit 1ce0df4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions broker/http_broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"sync"
"time"

"github.com/google/uuid"
"github.com/micro/go-log"
"github.com/micro/go-micro/broker/codec/json"
merr "github.com/micro/go-micro/errors"
Expand All @@ -26,7 +27,6 @@ import (
maddr "github.com/micro/util/go/lib/addr"
mnet "github.com/micro/util/go/lib/net"
mls "github.com/micro/util/go/lib/tls"
"github.com/pborman/uuid"
)

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

h := &httpBroker{
id: "broker-" + uuid.NewUUID().String(),
id: "broker-" + uuid.New().String(),
address: addr,
opts: options,
r: reg,
Expand Down Expand Up @@ -413,7 +413,7 @@ func (h *httpBroker) Init(opts ...Option) error {
}

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

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

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

var secure bool

Expand Down
6 changes: 3 additions & 3 deletions broker/http_broker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import (
"testing"
"time"

"github.com/google/uuid"
"github.com/micro/go-micro/registry/mock"
"github.com/pborman/uuid"
)

func sub(be *testing.B, c int) {
be.StopTimer()
m := mock.NewRegistry()
b := NewBroker(Registry(m))
topic := uuid.NewUUID().String()
topic := uuid.New().String()

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

if err := b.Init(); err != nil {
be.Fatalf("Unexpected init error: %v", err)
Expand Down
4 changes: 2 additions & 2 deletions broker/mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"errors"
"sync"

"github.com/google/uuid"
"github.com/micro/go-micro/broker"
"github.com/pborman/uuid"
)

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

sub := &mockSubscriber{
exit: make(chan bool, 1),
id: uuid.NewUUID().String(),
id: uuid.New().String(),
topic: topic,
handler: handler,
opts: options,
Expand Down
4 changes: 2 additions & 2 deletions server/mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"errors"
"sync"

"github.com/google/uuid"
"github.com/micro/go-micro/server"
"github.com/pborman/uuid"
)

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

return &MockHandler{
Id: uuid.NewUUID().String(),
Id: uuid.New().String(),
Hdlr: h,
Opts: options,
}
Expand Down
4 changes: 2 additions & 2 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"os/signal"
"syscall"

"github.com/google/uuid"
"github.com/micro/go-log"
"github.com/pborman/uuid"
)

type Server interface {
Expand Down Expand Up @@ -63,7 +63,7 @@ var (
DefaultAddress = ":0"
DefaultName = "go-server"
DefaultVersion = "1.0.0"
DefaultId = uuid.NewUUID().String()
DefaultId = uuid.New().String()
DefaultServer Server = newRpcServer()
)

Expand Down

0 comments on commit 1ce0df4

Please sign in to comment.