From 1091d69fedadba5ddd9c1602d2cb5ea8a6045fa4 Mon Sep 17 00:00:00 2001 From: fuling Date: Thu, 7 May 2020 17:44:54 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=8D=87=E7=BA=A7]=20satori/go.uuid=EF=BC=9A?= =?UTF-8?q?=201.2.0=20=E5=8D=87=E7=BA=A7=E5=88=B0=201.2.1=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20https://github.com/satori/go.uuid/issues/1?= =?UTF-8?q?06=20=E8=BF=99=E4=B8=AA=E9=97=AE=E9=A2=98=20Signed-off-by:=20fu?= =?UTF-8?q?ling=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/nacos_server/nacos_server.go | 12 ++++++++++-- go.mod | 2 +- go.sum | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/common/nacos_server/nacos_server.go b/common/nacos_server/nacos_server.go index 7c003e65..b1a0c9b0 100644 --- a/common/nacos_server/nacos_server.go +++ b/common/nacos_server/nacos_server.go @@ -80,7 +80,11 @@ func (server *NacosServer) callConfigServer(api string, params map[string]string //headers["Accept-Encoding"] = []string{"gzip,deflate,sdch"} headers["Connection"] = []string{"Keep-Alive"} headers["exConfigInfo"] = []string{"true"} - headers["RequestId"] = []string{uuid.NewV4().String()} + uid, err := uuid.NewV4() + if err != nil { + return + } + headers["RequestId"] = []string{uid.String()} headers["Request-Module"] = []string{"Naming"} headers["Content-Type"] = []string{"application/x-www-form-urlencoded;charset=utf-8"} headers["Spas-AccessKey"] = []string{newHeaders["accessKey"]} @@ -119,7 +123,11 @@ func (server *NacosServer) callServer(api string, params map[string]string, meth headers["User-Agent"] = []string{constant.CLIENT_VERSION} //headers["Accept-Encoding"] = []string{"gzip,deflate,sdch"} headers["Connection"] = []string{"Keep-Alive"} - headers["RequestId"] = []string{uuid.NewV4().String()} + uid, err := uuid.NewV4() + if err != nil { + return + } + headers["RequestId"] = []string{uid.String()} headers["Request-Module"] = []string{"Naming"} headers["Content-Type"] = []string{"application/x-www-form-urlencoded;charset=utf-8"} diff --git a/go.mod b/go.mod index 32cf9d7f..e2c52631 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/lestrrat/go-file-rotatelogs v0.0.0-20180223000712-d3151e2a480f github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042 // indirect github.com/pkg/errors v0.9.1 - github.com/satori/go.uuid v1.2.0 + github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b github.com/stretchr/testify v1.5.1 github.com/tebeka/strftime v0.1.3 // indirect github.com/toolkits/concurrent v0.0.0-20150624120057-a4371d70e3e3 diff --git a/go.sum b/go.sum index 905893a9..7cce5e87 100644 --- a/go.sum +++ b/go.sum @@ -41,6 +41,7 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a h1:pa8hGb/2YqsZKovtsgrwcDH1RZhVbTKCjLp47XpqCDs=