From c598b4c45081adf88e23167a1a021c6cdedc2128 Mon Sep 17 00:00:00 2001 From: yosuzzy Date: Sun, 19 May 2024 01:42:28 +0900 Subject: [PATCH 1/2] fix: deprecated code changes --- examples/route_guide/client/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/route_guide/client/client.go b/examples/route_guide/client/client.go index d027d2d6d42b..49c80932f96d 100644 --- a/examples/route_guide/client/client.go +++ b/examples/route_guide/client/client.go @@ -168,7 +168,7 @@ func main() { opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) } - conn, err := grpc.Dial(*serverAddr, opts...) + conn, err := grpc.NewClient(*serverAddr, opts...) if err != nil { log.Fatalf("fail to dial: %v", err) } From fa90fa091ffaeeb3823d45b942fdb3ade178957a Mon Sep 17 00:00:00 2001 From: yosuzzy Date: Tue, 21 May 2024 23:49:48 +0900 Subject: [PATCH 2/2] fix: modify MD also --- examples/gotutorial.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/gotutorial.md b/examples/gotutorial.md index 10843f61d051..69a6632b7724 100644 --- a/examples/gotutorial.md +++ b/examples/gotutorial.md @@ -278,17 +278,17 @@ In this section, we'll look at creating a Go client for our `RouteGuide` service ### Creating a stub -To call service methods, we first need to create a gRPC *channel* to communicate with the server. We create this by passing the server address and port number to `grpc.Dial()` as follows: +To call service methods, we first need to create a gRPC *channel* to communicate with the server. We create this by passing the server address and port number to `grpc.NewClient()` as follows: ```go -conn, err := grpc.Dial(*serverAddr) +conn, err := grpc.NewClient(*serverAddr) if err != nil { ... } defer conn.Close() ``` -You can use `DialOptions` to set the auth credentials (e.g., TLS, GCE credentials, JWT credentials) in `grpc.Dial` if the service you request requires that - however, we don't need to do this for our `RouteGuide` service. +You can use `DialOptions` to set the auth credentials (e.g., TLS, GCE credentials, JWT credentials) in `grpc.NewClient` if the service you request requires that - however, we don't need to do this for our `RouteGuide` service. Once the gRPC *channel* is setup, we need a client *stub* to perform RPCs. We get this using the `NewRouteGuideClient` method provided in the `pb` package we generated from our `.proto` file.