diff --git a/examples/dubbo/go-client/app/client.go b/examples/dubbo/go-client/app/client.go index b0e1a51f45c0fcf01daa4cbba5109d3314a4bc39..6adeecbe16a77391d453ea51f19e2e911b1617d4 100644 --- a/examples/dubbo/go-client/app/client.go +++ b/examples/dubbo/go-client/app/client.go @@ -93,7 +93,7 @@ func initClient(clientConfig *examples.ClientConfig) { } for _, service := range clientConfig.Service_List { - err = clientRegistry.RegisterConsumer(&service) + err = clientRegistry.RegisterConsumer(service) if err != nil { panic(fmt.Sprintf("registry.Register(service{%#v}) = error{%v}", service, jerrors.ErrorStack(err))) return diff --git a/examples/jsonrpc/go-client/app/client.go b/examples/jsonrpc/go-client/app/client.go index bddf1da15c906cd63bef8873b2888956e5004009..ed394b223787d9365c51b6f867f1704a92dd86d1 100644 --- a/examples/jsonrpc/go-client/app/client.go +++ b/examples/jsonrpc/go-client/app/client.go @@ -96,7 +96,7 @@ func initClient(clientConfig *examples.ClientConfig) { } for _, service := range clientConfig.Service_List { - err = clientRegistry.RegisterConsumer(&service) + err = clientRegistry.RegisterConsumer(service) if err != nil { panic(fmt.Sprintf("registry.Register(service{%#v}) = error{%v}", service, jerrors.ErrorStack(err))) return diff --git a/examples/jsonrpc/go-client/app/test.go b/examples/jsonrpc/go-client/app/test.go index fb3d008b04d39b02888e46f605907de7f75265fb..ac0053e0ae8847be086c51925021028ba249c039 100644 --- a/examples/jsonrpc/go-client/app/test.go +++ b/examples/jsonrpc/go-client/app/test.go @@ -3,6 +3,7 @@ package main import ( "context" "fmt" + "github.com/dubbo/dubbo-go/registry" _ "net/http/pprof" ) @@ -14,7 +15,6 @@ import ( "github.com/dubbo/dubbo-go/examples" "github.com/dubbo/dubbo-go/jsonrpc" "github.com/dubbo/dubbo-go/public" - "github.com/dubbo/dubbo-go/service" ) func testJsonrpc(clientConfig *examples.ClientConfig, userKey string, method string) { @@ -24,7 +24,7 @@ func testJsonrpc(clientConfig *examples.ClientConfig, userKey string, method str serviceIdx int user *JsonRPCUser ctx context.Context - conf service.ServiceConfig + conf registry.ServiceConfig req jsonrpc.Request ) @@ -42,7 +42,7 @@ func testJsonrpc(clientConfig *examples.ClientConfig, userKey string, method str // Create request // gxlog.CInfo("jsonrpc selected service %#v", clientConfig.Service_List[serviceIdx]) - conf = service.ServiceConfig{ + conf = registry.ServiceConfig{ Group: clientConfig.Service_List[serviceIdx].Group, Protocol: public.CodecType(public.CODECTYPE_JSONRPC).String(), Version: clientConfig.Service_List[serviceIdx].Version, diff --git a/registry/zookeeper/consumer.go b/registry/zookeeper/consumer.go index c5073db90b3433f0ec0421094adf6f4c17f4d131..9f4e9201cfe5274ba20e8329927c880e41404bd5 100644 --- a/registry/zookeeper/consumer.go +++ b/registry/zookeeper/consumer.go @@ -19,10 +19,10 @@ func (r *ZkRegistry) RegisterConsumer(regConf registry.ServiceConfigIf) error { ok bool err error listener *zkEventListener - conf *registry.ServiceConfig + conf registry.ServiceConfig ) - if conf, ok = regConf.(*registry.ServiceConfig); !ok { + if conf, ok = regConf.(registry.ServiceConfig); !ok { return jerrors.Errorf("the type of @regConf %T is not registry.ServiceConfig", regConf) } @@ -48,7 +48,7 @@ func (r *ZkRegistry) RegisterConsumer(regConf registry.ServiceConfigIf) error { listener = r.listener r.listenerLock.Unlock() if listener != nil { - go listener.listenServiceEvent(conf) + go listener.listenServiceEvent(&conf) } return nil diff --git a/registry/zookeeper/registry.go b/registry/zookeeper/registry.go index 8f75027346e311aa5dd1a6a08bdfa9191f15f422..a65f68d56db2b07cd2d0c5935db7142b7116c38f 100644 --- a/registry/zookeeper/registry.go +++ b/registry/zookeeper/registry.go @@ -278,7 +278,7 @@ func (r *ZkRegistry) register(c registry.ServiceConfigIf) error { if r.DubboType == registry.PROVIDER { conf, ok := c.(registry.ProviderServiceConfig) if !ok { - return fmt.Errorf("the type of @c:%+v is not *registry.ProviderServiceConfig", c) + return fmt.Errorf("the type of @c:%+v is not registry.ProviderServiceConfig", c) } if conf.Service == "" || conf.Methods == "" { @@ -331,9 +331,9 @@ func (r *ZkRegistry) register(c registry.ServiceConfigIf) error { log.Debug("provider path:%s, url:%s", dubboPath, rawURL) } else if r.DubboType == registry.CONSUMER { - conf, ok := c.(*registry.ServiceConfig) - if ok { - return fmt.Errorf("the type of @c:%+v is not *registry.ServiceConfig", c) + conf, ok := c.(registry.ServiceConfig) + if !ok { + return fmt.Errorf("the type of @c:%+v is not registry.ServiceConfig", c) } dubboPath = fmt.Sprintf("/dubbo/%s/%s", conf.Service, registry.DubboNodes[registry.CONSUMER])