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. 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) }