Skip to content

Commit

Permalink
Remove odd uses of satori/go.uuid package (#2985)
Browse files Browse the repository at this point in the history
  • Loading branch information
vdarulis authored Dec 5, 2020
1 parent d21e701 commit ef87f84
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ require (
github.com/remeh/sizedwaitgroup v1.0.0 // indirect
github.com/rhysd/go-github-selfupdate v1.2.2 // indirect
github.com/rveen/ogdl v0.0.0-20200522080342-eeeda1a978e7 // indirect
github.com/satori/go.uuid v1.2.0
github.com/sergi/go-diff v1.1.0
github.com/shirou/gopsutil v2.20.5+incompatible // indirect
github.com/sirupsen/logrus v1.7.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions src/dbnode/namespace/kvadmin/ns_admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"errors"
"fmt"

uuid "github.com/satori/go.uuid"
"github.com/pborman/uuid"

"github.com/m3db/m3/src/cluster/kv"
nsproto "github.com/m3db/m3/src/dbnode/generated/proto/namespace"
Expand Down Expand Up @@ -53,7 +53,7 @@ const (
func NewAdminService(store kv.Store, key string, idGen func() string) NamespaceMetadataAdminService {
if idGen == nil {
idGen = func() string {
return uuid.NewV4().String()
return uuid.New()
}
}
if len(key) == 0 {
Expand Down
6 changes: 3 additions & 3 deletions src/m3em/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
xclock "github.com/m3db/m3/src/x/clock"
xerrors "github.com/m3db/m3/src/x/errors"

uuid "github.com/satori/go.uuid"
"github.com/pborman/uuid"
"go.uber.org/zap"
"google.golang.org/grpc"
)
Expand Down Expand Up @@ -78,7 +78,7 @@ func New(
return nil, err
}

uuid := uuid.NewV4().Bytes()
uuid := uuid.NewRandom()

var (
retNode = &svcNode{
Expand All @@ -88,7 +88,7 @@ func New(
status: StatusUninitialized,
}
listeners = newListenerGroup(retNode)
hbUUID = string(uuid[:])
hbUUID = uuid.String()
heartbeater *opHeartbeatServer
routerEndpoint string
)
Expand Down
6 changes: 3 additions & 3 deletions src/m3ninx/util/uuid.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ import (
"encoding/base64"
"errors"

"github.com/satori/go.uuid"
"github.com/pborman/uuid"
)

var errUUIDForbidden = errors.New("generating UUIDs is forbidden")

var encodedLen = base64.StdEncoding.EncodedLen(uuid.Size)
var encodedLen = base64.StdEncoding.EncodedLen(len(new(uuid.Array)))

// NewUUIDFn is a function for creating new UUIDs.
type NewUUIDFn func() ([]byte, error)
Expand All @@ -42,7 +42,7 @@ func NewUUID() ([]byte, error) {
// guaranteed to be unique since we may have multiple processes running on the
// same host. Elasticsearch uses Flake IDs which ensure uniqueness by requiring
// an initial coordination step and we may want to consider doing the same.
uuid := uuid.NewV4().Bytes()
uuid := uuid.NewRandom()

buf := make([]byte, encodedLen)
base64.StdEncoding.Encode(buf, uuid)
Expand Down

0 comments on commit ef87f84

Please sign in to comment.