Skip to content

Commit d3e6985

Browse files
committed
Use gofrs uuid
1 parent a1cf134 commit d3e6985

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

client.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"encoding/json"
88
"net/http"
99

10-
uuid "github.com/satori/go.uuid"
10+
uuid "github.com/gofrs/uuid"
1111
)
1212

1313
const (
@@ -90,8 +90,13 @@ func (c *client) Call(ctx context.Context, methodName string, params interface{}
9090
requestID, _ := RequestIDFromContext(ctx)
9191

9292
if requestID == nil {
93+
reqUUID, err := uuid.NewV4()
94+
if err != nil {
95+
return err
96+
}
97+
9398
// We do not use json.Marshal because we know the json representation of a string.
94-
requestIDVal := json.RawMessage("\"" + uuid.NewV4().String() + "\"")
99+
requestIDVal := json.RawMessage("\"" + reqUUID.String() + "\"")
95100
requestID = &requestIDVal
96101
}
97102

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ module github.com/space307/jsonrpc2
33
go 1.12
44

55
require (
6+
github.com/gofrs/uuid v3.2.0+incompatible
67
github.com/gorilla/websocket v1.4.1 // indirect
78
github.com/mailru/easyjson v0.7.0
89
github.com/prometheus/client_golang v1.1.0 // indirect
9-
github.com/satori/go.uuid v1.2.0
1010
github.com/semrush/zenrpc v1.1.1
1111
github.com/stretchr/testify v1.3.0
1212
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2
1111
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
1212
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
1313
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
14+
github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE=
15+
github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
1416
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
1517
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
1618
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@@ -51,8 +53,6 @@ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R
5153
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
5254
github.com/prometheus/procfs v0.0.3 h1:CTwfnzjQ+8dS6MhHHu4YswVAD99sL2wjPqP+VkURmKE=
5355
github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
54-
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
55-
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
5656
github.com/semrush/zenrpc v1.1.1 h1:McE4BFoXP95NnDU+tQHhfzVpmODS4p55JKXxHR64nx4=
5757
github.com/semrush/zenrpc v1.1.1/go.mod h1:DUljRIQQJL9gBAYcwuZHsIK/GTIFUImy8UqhioyJvKQ=
5858
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=

0 commit comments

Comments
 (0)