From a002ae9e2bceaa235ef17dcefbd1ea78c0f52de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9C=8B=E7=B9=81=E6=98=9F?= <12936615+kanfanxing@user.noreply.gitee.com> Date: Tue, 20 Feb 2024 15:40:47 +0800 Subject: [PATCH] uuid --- client/client.go | 6 +++--- go.mod | 7 +++++-- go.sum | 11 +++++++++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/client/client.go b/client/client.go index f00e6d3..7b71ce8 100644 --- a/client/client.go +++ b/client/client.go @@ -1,8 +1,8 @@ package client import ( - uuid "github.com/go.uuid-master" "github.com/gorilla/websocket" + uuid "github.com/satori/go.uuid" ) type Client struct { @@ -22,13 +22,13 @@ type Clients []Client // GetAuthentication 对client进行认证 func (client *Client) GetAuthentication() { - id, _ := uuid.NewV1() + id := uuid.NewV4() client.Uuid = id.String() } // BuildRoom GetRoomId 创建房间 func (client *Client) BuildRoom() { - id, _ := uuid.NewV1() + id := uuid.NewV4() client.RoomId = id.String() temp := make(map[string]*Client) diff --git a/go.mod b/go.mod index a70e908..9aa450b 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,11 @@ module DifProject go 1.21 require ( - github.com/google/uuid v1.6.0 github.com/gorilla/websocket v1.5.1 + github.com/satori/go.uuid v1.2.0 ) -require golang.org/x/net v0.17.0 // indirect +require ( + golang.org/x/net v0.17.0 // indirect + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect +) diff --git a/go.sum b/go.sum index 40286fc..1a1a976 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,13 @@ -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -- Gitee