DMwangnima commented on code in PR #727:
URL: https://github.com/apache/dubbo-go-samples/pull/727#discussion_r1527184865


##########
service_discovery/service/go-client/client.go:
##########
@@ -0,0 +1,69 @@
+/*
+ * 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"
+       // "time"
+
+       "dubbo.apache.org/dubbo-go/v3"
+       // "dubbo.apache.org/dubbo-go/v3/config"
+
+       _ "dubbo.apache.org/dubbo-go/v3/client"
+       _ "dubbo.apache.org/dubbo-go/v3/imports"
+       "dubbo.apache.org/dubbo-go/v3/registry"
+       greet 
"github.com/apache/dubbo-go-samples/service_discovery/service/proto"
+       "github.com/dubbogo/gost/log/logger"
+)
+
+func main() {
+
+       //global conception
+       //configure global configurations and common modules
+       ins, err := dubbo.NewInstance(
+               dubbo.WithName("dubbo-go-client"),
+               dubbo.WithRegistry(
+                       registry.WithNacos(),
+                       registry.WithAddress("127.0.0.1:8848"),
+               ),
+
+               // dubbo.WithMetadataReport(metadata.WithMetadata())),
+       )
+       if err != nil {
+               panic(err)
+       }
+       // configure the params that only client layer cares
+       cli, err := ins.NewClient()
+
+       if err != nil {
+               panic(err)
+       }
+
+       svc, err := greet.NewGreetService(cli)
+
+       if err != nil {
+               panic(err)
+       }
+
+       resp, err := svc.Greet(context.Background(), &greet.GreetRequest{Name: 
"hello world"})
+       if err != nil {
+               logger.Error(err)
+       }
+       logger.Infof("Greet response: %s", resp)
+       // select {}

Review Comment:
   ditto.



##########
service_discovery/service/go-client/client.go:
##########
@@ -0,0 +1,69 @@
+/*
+ * 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"
+       // "time"
+
+       "dubbo.apache.org/dubbo-go/v3"
+       // "dubbo.apache.org/dubbo-go/v3/config"
+
+       _ "dubbo.apache.org/dubbo-go/v3/client"

Review Comment:
   Why is it implicitly imported here?



##########
service_discovery/service/go-client/client.go:
##########
@@ -0,0 +1,69 @@
+/*
+ * 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"
+       // "time"

Review Comment:
   If you do not need these packages, pls remove them



##########
service_discovery/service/go-server/server.go:
##########
@@ -0,0 +1,65 @@
+package main
+
+import (
+       "context"
+
+       "dubbo.apache.org/dubbo-go/v3"
+       // "dubbo.apache.org/dubbo-go/v3/config"
+       _ "dubbo.apache.org/dubbo-go/v3/imports"
+
+       "dubbo.apache.org/dubbo-go/v3/protocol"
+       "dubbo.apache.org/dubbo-go/v3/registry"
+
+       greet 
"github.com/apache/dubbo-go-samples/service_discovery/service/proto"
+       "github.com/dubbogo/gost/log/logger"
+)
+
+type GreetTripleServer struct {
+}
+
+func (svr *GreetTripleServer) Greet(ctx context.Context, req 
*greet.GreetRequest) (*greet.GreetResponse, error) {
+       resp := &greet.GreetResponse{Greeting: req.Name}
+       return resp, nil
+}
+
+func (s *GreetTripleServer) MethodMapper() map[string]string {

Review Comment:
   If we do not add ```MethodMapper``` method, Java client could not invoke the 
Go Server?



##########
service_discovery/service/go-client/client.go:
##########
@@ -0,0 +1,69 @@
+/*
+ * 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"
+       // "time"
+
+       "dubbo.apache.org/dubbo-go/v3"
+       // "dubbo.apache.org/dubbo-go/v3/config"
+
+       _ "dubbo.apache.org/dubbo-go/v3/client"
+       _ "dubbo.apache.org/dubbo-go/v3/imports"
+       "dubbo.apache.org/dubbo-go/v3/registry"
+       greet 
"github.com/apache/dubbo-go-samples/service_discovery/service/proto"
+       "github.com/dubbogo/gost/log/logger"
+)
+
+func main() {
+
+       //global conception
+       //configure global configurations and common modules
+       ins, err := dubbo.NewInstance(
+               dubbo.WithName("dubbo-go-client"),
+               dubbo.WithRegistry(
+                       registry.WithNacos(),
+                       registry.WithAddress("127.0.0.1:8848"),
+               ),
+
+               // dubbo.WithMetadataReport(metadata.WithMetadata())),

Review Comment:
   ditto.



##########
service_discovery/service/go-server/server.go:
##########
@@ -0,0 +1,65 @@
+package main
+
+import (
+       "context"
+
+       "dubbo.apache.org/dubbo-go/v3"
+       // "dubbo.apache.org/dubbo-go/v3/config"

Review Comment:
   ditto.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to