You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/03/24 04:57:56 UTC

[dubbo-go-samples] branch master updated: fix: issue#71

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 0ab36fc  fix: issue#71
     new 7d40940  Merge pull request #72 from beiwei30/hello-world
0ab36fc is described below

commit 0ab36fcbe5192a8a12ec03f4e65a41429884368c
Author: Ian Luo <ia...@gmail.com>
AuthorDate: Sat Mar 20 21:21:29 2021 +0800

    fix: issue#71
---
 helloworld/go-client/cmd/client.go                  | 10 +++++-----
 helloworld/go-server/cmd/server.go                  |  7 +++++--
 helloworld/go-server/pkg/user.go                    | 11 -----------
 helloworld/go-server/tests/integration/main_test.go |  3 +--
 4 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/helloworld/go-client/cmd/client.go b/helloworld/go-client/cmd/client.go
index b9a3c3a..c44abbd 100644
--- a/helloworld/go-client/cmd/client.go
+++ b/helloworld/go-client/cmd/client.go
@@ -25,11 +25,6 @@ import (
 
 import (
 	hessian "github.com/apache/dubbo-go-hessian2"
-	"github.com/apache/dubbo-go-samples/helloworld/go-client/pkg"
-	"github.com/dubbogo/gost/log"
-)
-
-import (
 	_ "github.com/apache/dubbo-go/cluster/cluster_impl"
 	_ "github.com/apache/dubbo-go/cluster/loadbalance"
 	_ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
@@ -38,6 +33,11 @@ import (
 	_ "github.com/apache/dubbo-go/protocol/dubbo"
 	_ "github.com/apache/dubbo-go/registry/protocol"
 	_ "github.com/apache/dubbo-go/registry/zookeeper"
+	gxlog "github.com/dubbogo/gost/log"
+)
+
+import (
+	"github.com/apache/dubbo-go-samples/helloworld/go-client/pkg"
 )
 
 var userProvider = new(pkg.UserProvider)
diff --git a/helloworld/go-server/cmd/server.go b/helloworld/go-server/cmd/server.go
index 8dc92ab..144f42a 100644
--- a/helloworld/go-server/cmd/server.go
+++ b/helloworld/go-server/cmd/server.go
@@ -27,8 +27,6 @@ import (
 
 import (
 	hessian "github.com/apache/dubbo-go-hessian2"
-	"github.com/apache/dubbo-go-samples/helloworld/go-server/pkg"
-
 	_ "github.com/apache/dubbo-go/cluster/cluster_impl"
 	_ "github.com/apache/dubbo-go/cluster/loadbalance"
 	"github.com/apache/dubbo-go/common/logger"
@@ -40,6 +38,10 @@ import (
 	_ "github.com/apache/dubbo-go/registry/zookeeper"
 )
 
+import (
+	"github.com/apache/dubbo-go-samples/helloworld/go-server/pkg"
+)
+
 var (
 	survivalTimeout = int(3e9)
 )
@@ -47,6 +49,7 @@ var (
 // need to setup environment variable "CONF_PROVIDER_FILE_PATH" to "conf/server.yml" before run
 func main() {
 	hessian.RegisterPOJO(&pkg.User{})
+	config.SetProviderService(new(pkg.UserProvider))
 	config.Load()
 
 	initSignal()
diff --git a/helloworld/go-server/pkg/user.go b/helloworld/go-server/pkg/user.go
index 9920a59..8e34bf0 100644
--- a/helloworld/go-server/pkg/user.go
+++ b/helloworld/go-server/pkg/user.go
@@ -26,17 +26,6 @@ import (
 	"github.com/dubbogo/gost/log"
 )
 
-import (
-	hessian "github.com/apache/dubbo-go-hessian2"
-	"github.com/apache/dubbo-go/config"
-)
-
-func init() {
-	config.SetProviderService(new(UserProvider))
-	// ------for hessian2------
-	hessian.RegisterPOJO(&User{})
-}
-
 type User struct {
 	ID   string
 	Name string
diff --git a/helloworld/go-server/tests/integration/main_test.go b/helloworld/go-server/tests/integration/main_test.go
index 4a75f7a..b4a5139 100644
--- a/helloworld/go-server/tests/integration/main_test.go
+++ b/helloworld/go-server/tests/integration/main_test.go
@@ -28,11 +28,10 @@ import (
 
 import (
 	hessian "github.com/apache/dubbo-go-hessian2"
-	"github.com/apache/dubbo-go/config"
-
 	_ "github.com/apache/dubbo-go/cluster/cluster_impl"
 	_ "github.com/apache/dubbo-go/cluster/loadbalance"
 	_ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
+	"github.com/apache/dubbo-go/config"
 	_ "github.com/apache/dubbo-go/filter/filter_impl"
 	_ "github.com/apache/dubbo-go/metadata/service/inmemory"
 	_ "github.com/apache/dubbo-go/protocol/dubbo"