This is an automated email from the ASF dual-hosted git repository.

iluo pushed a commit to branch makefile
in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git


The following commit(s) were added to refs/heads/makefile by this push:
     new 47811fd  clean up useless code
47811fd is described below

commit 47811fd7c96abf78cdface5c0a9874c25cdd8649
Author: Ian Luo <[email protected]>
AuthorDate: Fri Oct 30 17:52:19 2020 +0800

    clean up useless code
---
 async/go-client/pkg/user.go                  | 22 ++++++++++++++++++++++
 configcenter/apollo/go-client/pkg/user.go    | 22 ----------------------
 configcenter/nacos/go-client/pkg/user.go     | 22 ----------------------
 configcenter/zookeeper/go-client/pkg/user.go | 22 ----------------------
 filter/custom_filter/go-client/pkg/user.go   | 26 --------------------------
 helloworld/go-client/pkg/user.go             | 26 --------------------------
 6 files changed, 22 insertions(+), 118 deletions(-)

diff --git a/async/go-client/pkg/user.go b/async/go-client/pkg/user.go
index 75c964f..26bea90 100644
--- a/async/go-client/pkg/user.go
+++ b/async/go-client/pkg/user.go
@@ -19,6 +19,10 @@ package pkg
 
 import (
        "context"
+       "github.com/apache/dubbo-go/common"
+       "github.com/apache/dubbo-go/protocol"
+       "github.com/apache/dubbo-go/remoting"
+       gxlog "github.com/dubbogo/gost/log"
        "time"
 )
 
@@ -31,6 +35,7 @@ type User struct {
 
 type UserProvider struct {
        GetUser func(ctx context.Context, req []interface{}, rsp *User) error
+       ch      chan *User
 }
 
 func (u *UserProvider) Reference() string {
@@ -40,3 +45,20 @@ func (u *UserProvider) Reference() string {
 func (User) JavaClassName() string {
        return "org.apache.dubbo.User"
 }
+
+// to enable async call:
+// 1. need to implement AsyncCallbackService
+// 2. need to specify references -> UserProvider -> async in conf/client.yml
+func (u *UserProvider) CallBack(res common.CallbackResponse) {
+       gxlog.CInfo("CallBack res: %v", res)
+       if r, ok := res.(remoting.AsyncCallbackResponse); ok {
+               if reply, ok := r.Reply.(*remoting.Response); ok {
+                       if result, ok := reply.Result.(*protocol.RPCResult); ok 
{
+                               if user, ok := result.Rest.(*User); ok {
+                                       u.ch <- user
+                               }
+                       }
+               }
+       }
+       u.ch <- nil
+}
\ No newline at end of file
diff --git a/configcenter/apollo/go-client/pkg/user.go 
b/configcenter/apollo/go-client/pkg/user.go
index abcad09..75c964f 100644
--- a/configcenter/apollo/go-client/pkg/user.go
+++ b/configcenter/apollo/go-client/pkg/user.go
@@ -19,10 +19,6 @@ package pkg
 
 import (
        "context"
-       "github.com/apache/dubbo-go/common"
-       "github.com/apache/dubbo-go/protocol"
-       "github.com/apache/dubbo-go/remoting"
-       gxlog "github.com/dubbogo/gost/log"
        "time"
 )
 
@@ -35,30 +31,12 @@ type User struct {
 
 type UserProvider struct {
        GetUser func(ctx context.Context, req []interface{}, rsp *User) error
-       Ch      chan *User
 }
 
 func (u *UserProvider) Reference() string {
        return "UserProvider"
 }
 
-// to enable async call:
-// 1. need to implement AsyncCallbackService
-// 2. need to specify references -> UserProvider -> async in conf/client.yml
-func (u *UserProvider) CallBack(res common.CallbackResponse) {
-       gxlog.CInfo("CallBack res: %v", res)
-       if r, ok := res.(remoting.AsyncCallbackResponse); ok {
-               if reply, ok := r.Reply.(*remoting.Response); ok {
-                       if result, ok := reply.Result.(*protocol.RPCResult); ok 
{
-                               if user, ok := result.Rest.(*User); ok {
-                                       u.Ch <- user
-                               }
-                       }
-               }
-       }
-       u.Ch <- nil
-}
-
 func (User) JavaClassName() string {
        return "org.apache.dubbo.User"
 }
diff --git a/configcenter/nacos/go-client/pkg/user.go 
b/configcenter/nacos/go-client/pkg/user.go
index abcad09..75c964f 100644
--- a/configcenter/nacos/go-client/pkg/user.go
+++ b/configcenter/nacos/go-client/pkg/user.go
@@ -19,10 +19,6 @@ package pkg
 
 import (
        "context"
-       "github.com/apache/dubbo-go/common"
-       "github.com/apache/dubbo-go/protocol"
-       "github.com/apache/dubbo-go/remoting"
-       gxlog "github.com/dubbogo/gost/log"
        "time"
 )
 
@@ -35,30 +31,12 @@ type User struct {
 
 type UserProvider struct {
        GetUser func(ctx context.Context, req []interface{}, rsp *User) error
-       Ch      chan *User
 }
 
 func (u *UserProvider) Reference() string {
        return "UserProvider"
 }
 
-// to enable async call:
-// 1. need to implement AsyncCallbackService
-// 2. need to specify references -> UserProvider -> async in conf/client.yml
-func (u *UserProvider) CallBack(res common.CallbackResponse) {
-       gxlog.CInfo("CallBack res: %v", res)
-       if r, ok := res.(remoting.AsyncCallbackResponse); ok {
-               if reply, ok := r.Reply.(*remoting.Response); ok {
-                       if result, ok := reply.Result.(*protocol.RPCResult); ok 
{
-                               if user, ok := result.Rest.(*User); ok {
-                                       u.Ch <- user
-                               }
-                       }
-               }
-       }
-       u.Ch <- nil
-}
-
 func (User) JavaClassName() string {
        return "org.apache.dubbo.User"
 }
diff --git a/configcenter/zookeeper/go-client/pkg/user.go 
b/configcenter/zookeeper/go-client/pkg/user.go
index abcad09..75c964f 100644
--- a/configcenter/zookeeper/go-client/pkg/user.go
+++ b/configcenter/zookeeper/go-client/pkg/user.go
@@ -19,10 +19,6 @@ package pkg
 
 import (
        "context"
-       "github.com/apache/dubbo-go/common"
-       "github.com/apache/dubbo-go/protocol"
-       "github.com/apache/dubbo-go/remoting"
-       gxlog "github.com/dubbogo/gost/log"
        "time"
 )
 
@@ -35,30 +31,12 @@ type User struct {
 
 type UserProvider struct {
        GetUser func(ctx context.Context, req []interface{}, rsp *User) error
-       Ch      chan *User
 }
 
 func (u *UserProvider) Reference() string {
        return "UserProvider"
 }
 
-// to enable async call:
-// 1. need to implement AsyncCallbackService
-// 2. need to specify references -> UserProvider -> async in conf/client.yml
-func (u *UserProvider) CallBack(res common.CallbackResponse) {
-       gxlog.CInfo("CallBack res: %v", res)
-       if r, ok := res.(remoting.AsyncCallbackResponse); ok {
-               if reply, ok := r.Reply.(*remoting.Response); ok {
-                       if result, ok := reply.Result.(*protocol.RPCResult); ok 
{
-                               if user, ok := result.Rest.(*User); ok {
-                                       u.Ch <- user
-                               }
-                       }
-               }
-       }
-       u.Ch <- nil
-}
-
 func (User) JavaClassName() string {
        return "org.apache.dubbo.User"
 }
diff --git a/filter/custom_filter/go-client/pkg/user.go 
b/filter/custom_filter/go-client/pkg/user.go
index 14c543f..75c964f 100644
--- a/filter/custom_filter/go-client/pkg/user.go
+++ b/filter/custom_filter/go-client/pkg/user.go
@@ -22,14 +22,6 @@ import (
        "time"
 )
 
-import (
-       "github.com/apache/dubbo-go/common"
-       "github.com/apache/dubbo-go/protocol"
-       "github.com/apache/dubbo-go/remoting"
-
-       gxlog "github.com/dubbogo/gost/log"
-)
-
 type User struct {
        Id   string
        Name string
@@ -39,30 +31,12 @@ type User struct {
 
 type UserProvider struct {
        GetUser func(ctx context.Context, req []interface{}, rsp *User) error
-       Ch      chan *User
 }
 
 func (u *UserProvider) Reference() string {
        return "UserProvider"
 }
 
-// to enable async call:
-// 1. need to implement AsyncCallbackService
-// 2. need to specify references -> UserProvider -> async in conf/client.yml
-func (u *UserProvider) CallBack(res common.CallbackResponse) {
-       gxlog.CInfo("CallBack res: %v", res)
-       if r, ok := res.(remoting.AsyncCallbackResponse); ok {
-               if reply, ok := r.Reply.(*remoting.Response); ok {
-                       if result, ok := reply.Result.(*protocol.RPCResult); ok 
{
-                               if user, ok := result.Rest.(*User); ok {
-                                       u.Ch <- user
-                               }
-                       }
-               }
-       }
-       u.Ch <- nil
-}
-
 func (User) JavaClassName() string {
        return "org.apache.dubbo.User"
 }
diff --git a/helloworld/go-client/pkg/user.go b/helloworld/go-client/pkg/user.go
index 14c543f..75c964f 100644
--- a/helloworld/go-client/pkg/user.go
+++ b/helloworld/go-client/pkg/user.go
@@ -22,14 +22,6 @@ import (
        "time"
 )
 
-import (
-       "github.com/apache/dubbo-go/common"
-       "github.com/apache/dubbo-go/protocol"
-       "github.com/apache/dubbo-go/remoting"
-
-       gxlog "github.com/dubbogo/gost/log"
-)
-
 type User struct {
        Id   string
        Name string
@@ -39,30 +31,12 @@ type User struct {
 
 type UserProvider struct {
        GetUser func(ctx context.Context, req []interface{}, rsp *User) error
-       Ch      chan *User
 }
 
 func (u *UserProvider) Reference() string {
        return "UserProvider"
 }
 
-// to enable async call:
-// 1. need to implement AsyncCallbackService
-// 2. need to specify references -> UserProvider -> async in conf/client.yml
-func (u *UserProvider) CallBack(res common.CallbackResponse) {
-       gxlog.CInfo("CallBack res: %v", res)
-       if r, ok := res.(remoting.AsyncCallbackResponse); ok {
-               if reply, ok := r.Reply.(*remoting.Response); ok {
-                       if result, ok := reply.Result.(*protocol.RPCResult); ok 
{
-                               if user, ok := result.Rest.(*User); ok {
-                                       u.Ch <- user
-                               }
-                       }
-               }
-       }
-       u.Ch <- nil
-}
-
 func (User) JavaClassName() string {
        return "org.apache.dubbo.User"
 }

Reply via email to