From 0a82036da5cb9fca3c0d7527a2fd85e9ad69898b Mon Sep 17 00:00:00 2001 From: shown Date: Thu, 22 Jan 2026 19:09:06 +0800 Subject: [PATCH] feat(contrib/registry): update nacos sdk to 2.3.5 (#4628) - Update nacos go sdk to 2.3.5; - ctx params not use, skip it; - adjust docs style --------- Signed-off-by: yuluo-yx Co-authored-by: hailaz <739476267@qq.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- contrib/registry/nacos/README.MD | 9 +++++---- contrib/registry/nacos/go.mod | 2 +- contrib/registry/nacos/go.sum | 4 ++-- contrib/registry/nacos/nacos.go | 2 +- contrib/registry/nacos/nacos_discovery.go | 2 +- contrib/registry/nacos/nacos_register.go | 4 ++-- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/contrib/registry/nacos/README.MD b/contrib/registry/nacos/README.MD index 6c76a77d1..51ec11143 100644 --- a/contrib/registry/nacos/README.MD +++ b/contrib/registry/nacos/README.MD @@ -1,24 +1,25 @@ # GoFrame Nacos Registry - Use `nacos` as service registration and discovery management. - ## Installation + ``` go get -u -v github.com/gogf/gf/contrib/registry/nacos/v2 ``` + suggested using `go.mod`: + ``` require github.com/gogf/gf/contrib/registry/nacos/v2 latest ``` - ## Example ### Reference example [server](../../../example/registry/nacos/http/server/main.go) + ```go package main @@ -44,6 +45,7 @@ func main() { ``` [client](../../../example/registry/nacos/http/client/main.go) + ```go package main @@ -78,4 +80,3 @@ func main() { ## License `GoFrame Nacos` is licensed under the [MIT License](../../../LICENSE), 100% free and open-source, forever. - diff --git a/contrib/registry/nacos/go.mod b/contrib/registry/nacos/go.mod index 48c7e198e..81afa3eba 100644 --- a/contrib/registry/nacos/go.mod +++ b/contrib/registry/nacos/go.mod @@ -4,7 +4,7 @@ go 1.23.0 require ( github.com/gogf/gf/v2 v2.9.8 - github.com/nacos-group/nacos-sdk-go/v2 v2.3.3 + github.com/nacos-group/nacos-sdk-go/v2 v2.3.5 ) require ( diff --git a/contrib/registry/nacos/go.sum b/contrib/registry/nacos/go.sum index 3d3d332ab..b34fac2f6 100644 --- a/contrib/registry/nacos/go.sum +++ b/contrib/registry/nacos/go.sum @@ -267,8 +267,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nacos-group/nacos-sdk-go/v2 v2.3.3 h1:lvkBZcYkKENLVR1ubO+vGxTP2L4VtVSArLvYZKuu4Pk= -github.com/nacos-group/nacos-sdk-go/v2 v2.3.3/go.mod h1:ygUBdt7eGeYBt6Lz2HO3wx7crKXk25Mp80568emGMWU= +github.com/nacos-group/nacos-sdk-go/v2 v2.3.5 h1:Hux7C4N4rWhwBF5Zm4yyYskrs9VTgrRTA8DZjoEhQTs= +github.com/nacos-group/nacos-sdk-go/v2 v2.3.5/go.mod h1:ygUBdt7eGeYBt6Lz2HO3wx7crKXk25Mp80568emGMWU= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5sM= github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= diff --git a/contrib/registry/nacos/nacos.go b/contrib/registry/nacos/nacos.go index 9ecdd3a6a..bd5ecb6f5 100644 --- a/contrib/registry/nacos/nacos.go +++ b/contrib/registry/nacos/nacos.go @@ -82,7 +82,7 @@ func New(address string, opts ...constant.ClientOption) (reg *Registry) { return } -// New creates and returns registry with Config. +// NewWithConfig creates and returns registry with Config. func NewWithConfig(ctx context.Context, config Config) (reg *Registry, err error) { // Data validation. err = g.Validator().Data(config).Run(ctx) diff --git a/contrib/registry/nacos/nacos_discovery.go b/contrib/registry/nacos/nacos_discovery.go index d9d1eecd9..5f16ced24 100644 --- a/contrib/registry/nacos/nacos_discovery.go +++ b/contrib/registry/nacos/nacos_discovery.go @@ -19,7 +19,7 @@ import ( ) // Search searches and returns services with specified condition. -func (reg *Registry) Search(ctx context.Context, in gsvc.SearchInput) (result []gsvc.Service, err error) { +func (reg *Registry) Search(_ context.Context, in gsvc.SearchInput) (result []gsvc.Service, err error) { if in.Prefix == "" && in.Name != "" { in.Prefix = gsvc.NewServiceWithName(in.Name).GetPrefix() } diff --git a/contrib/registry/nacos/nacos_register.go b/contrib/registry/nacos/nacos_register.go index c4c8ceddb..1b36c8c7b 100644 --- a/contrib/registry/nacos/nacos_register.go +++ b/contrib/registry/nacos/nacos_register.go @@ -17,7 +17,7 @@ import ( // Register registers `service` to Registry. // Note that it returns a new Service if it changes the input Service with custom one. -func (reg *Registry) Register(ctx context.Context, service gsvc.Service) (registered gsvc.Service, err error) { +func (reg *Registry) Register(_ context.Context, service gsvc.Service) (registered gsvc.Service, err error) { metadata := map[string]string{} endpoints := service.GetEndpoints() @@ -67,7 +67,7 @@ func (reg *Registry) Register(ctx context.Context, service gsvc.Service) (regist } // Deregister off-lines and removes `service` from the Registry. -func (reg *Registry) Deregister(ctx context.Context, service gsvc.Service) (err error) { +func (reg *Registry) Deregister(_ context.Context, service gsvc.Service) (err error) { c := reg.client for _, endpoint := range service.GetEndpoints() {