You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/09/07 17:33:14 UTC

[GitHub] [dubbo-go-samples] cjphaha commented on a change in pull request #230: Rft/add config enhance generic dubbo

cjphaha commented on a change in pull request #230:
URL: https://github.com/apache/dubbo-go-samples/pull/230#discussion_r703701294



##########
File path: generic/dubbo/go-client/conf/dubbogo.yml
##########
@@ -0,0 +1,12 @@
+dubbo:
+  registries:
+    zk:
+      protocol: "zookeeper"

Review comment:
       这个引号可以去掉

##########
File path: generic/dubbo/go-server/cmd/server.go
##########
@@ -18,61 +18,49 @@
 package main
 
 import (
+	"dubbo.apache.org/dubbo-go/v3/common/logger"
+	"dubbo.apache.org/dubbo-go/v3/config"

Review comment:
       同上面一样,一般第一个 import 块是原生包,第二个 import 块是外部的包,第三import 块是项目内部的包

##########
File path: generic/dubbo/go-client/cmd/client.go
##########
@@ -0,0 +1,316 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package main
+
+import (
+	"context"
+	"fmt"
+	"os"
+	"os/signal"
+	"syscall"
+	"time"
+)
+
+import (
+	_ "dubbo.apache.org/dubbo-go/v3/cluster/cluster_impl"
+	_ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance"
+	"dubbo.apache.org/dubbo-go/v3/common/logger"
+	_ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory"
+	"dubbo.apache.org/dubbo-go/v3/config"
+	"dubbo.apache.org/dubbo-go/v3/config/generic"
+	_ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl"
+	"dubbo.apache.org/dubbo-go/v3/protocol/dubbo"
+	_ "dubbo.apache.org/dubbo-go/v3/registry/protocol"
+	_ "dubbo.apache.org/dubbo-go/v3/registry/zookeeper"
+
+	hessian "github.com/apache/dubbo-go-hessian2"
+
+	"github.com/apache/dubbo-go-samples/generic/dubbo/go-client/pkg"

Review comment:
       这个放在第三个 import 块会好一些

##########
File path: generic/dubbo/go-server/cmd/server.go
##########
@@ -18,61 +18,49 @@
 package main
 
 import (
+	"dubbo.apache.org/dubbo-go/v3/common/logger"
+	"dubbo.apache.org/dubbo-go/v3/config"
+	_ "dubbo.apache.org/dubbo-go/v3/imports"
 	"fmt"
+	hessian "github.com/apache/dubbo-go-hessian2"
 	"os"
 	"os/signal"
 	"syscall"
 	"time"
 )
 
 import (
-	_ "dubbo.apache.org/dubbo-go/v3/cluster/cluster_impl"
-	_ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance"
-	"dubbo.apache.org/dubbo-go/v3/common/logger"
-	_ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory"
-	"dubbo.apache.org/dubbo-go/v3/config"
-	_ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl"
-	_ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo"
-	_ "dubbo.apache.org/dubbo-go/v3/registry/protocol"
-	_ "dubbo.apache.org/dubbo-go/v3/registry/zookeeper"
-
-	hessian "github.com/apache/dubbo-go-hessian2"
+	pkg "github.com/apache/dubbo-go-samples/generic/dubbo/go-server/pkg"
 )
 
-import (
-	"github.com/apache/dubbo-go-samples/generic/default/go-server/pkg"
-)
-
-var (
-	survivalTimeout = int(3e9)
-)
-
-// need to setup environment variable "CONF_PROVIDER_FILE_PATH" to "conf/server.yml" before run
+// export DUBBO_GO_CONFIG_PATH= PATH_TO_SAMPLES/generic/default/go-server/conf/dubbogo.yml
 func main() {
 	hessian.RegisterPOJO(&pkg.User{})
+	config.SetProviderService(&pkg.User{})
 	config.Load()
-
 	initSignal()
+	select {}

Review comment:
       initSignal 函数里面有一个 for 循环会阻塞住,这里可以不用 select{}

##########
File path: start_integrate_test.sh
##########
@@ -93,18 +93,20 @@
 DOCKER_DIR=$(pwd)/integrate_test/dockercompose
 
 array=("helloworld")
-array+=("direct")
-# config-api
-array+=("config-api/rpc/triple")
-array+=("config-api/configcenter/nacos")
-array+=("config-api/configcenter/zookeeper")
-# registry
-array+=("registry/zookeeper")
-array+=("registry/nacos")
-# rpc
-array+=("rpc/triple/codec-extension")
-array+=("rpc/triple/hessian2")
-array+=("rpc/triple/pb/dubbogo-grpc")
+##array+=("direct")
+### config-api
+##array+=("config-api/rpc/triple")
+##array+=("config-api/configcenter/nacos")
+##array+=("config-api/configcenter/zookeeper")
+### registry
+##array+=("registry/zookeeper")
+##array+=("registry/nacos")
+### rpc
+#array+=("rpc/triple/codec-extension")
+#array+=("rpc/triple/hessian2")
+#array+=("rpc/triple/pb/dubbogo-grpc")
+## generic
+#array=("generic/dubbo")

Review comment:
       这些集成测试可以保留着,不用注释掉,因为这部分是可以跑的




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org