Skip to content

Commit 708f7a1

Browse files
authored
Update Go documentation to use NewClient instead of Dial (#1295)
1 parent 571730d commit 708f7a1

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

content/en/blog/a-short-introduction-to-channelz.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,8 @@ As the error is on the client side, let's first click on
9696
TopChannels is a collection of root channels which don't have parents. In
9797
gRPC-Go, a top channel is a
9898
[ClientConn](https://godoc.org/google.golang.org/grpc#ClientConn) created by the
99-
user through [Dial](https://godoc.org/google.golang.org/grpc#Dial) or
100-
[DialContext](https://godoc.org/google.golang.org/grpc#DialContext), and used
101-
for making RPC calls. Top channels are of
99+
user through [NewClient](https://godoc.org/google.golang.org/grpc#NewClient),
100+
and used for making RPC calls. Top channels are of
102101
[Channel](https://github.com/grpc/grpc-proto/blob/9b13d199cc0d4703c7ea26c9c330ba695866eb23/grpc/channelz/v1/channelz.proto#L37)
103102
type in channelz, which is an abstraction of a connection that an RPC can be
104103
issued to.

content/en/docs/languages/go/alts.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ code:
1515
)
1616
1717
altsTC := alts.NewClientCreds(alts.DefaultClientOptions())
18-
conn, err := grpc.Dial(serverAddr, grpc.WithTransportCredentials(altsTC))
18+
conn, err := grpc.NewClient(serverAddr, grpc.WithTransportCredentials(altsTC))
1919
```
2020
server_credentials: |
2121
```go
@@ -37,7 +37,7 @@ code:
3737
clientOpts := alts.DefaultClientOptions()
3838
clientOpts.TargetServiceAccounts = []string{expectedServerSA}
3939
altsTC := alts.NewClientCreds(clientOpts)
40-
conn, err := grpc.Dial(serverAddr, grpc.WithTransportCredentials(altsTC))
40+
conn, err := grpc.NewClient(serverAddr, grpc.WithTransportCredentials(altsTC))
4141
```
4242
client_authorization: |
4343
```go

content/en/docs/languages/go/basics.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -389,21 +389,21 @@ service. You can see our complete example client code in
389389
390390
To call service methods, we first need to create a gRPC *channel* to communicate
391391
with the server. We create this by passing the server address and port number to
392-
`grpc.Dial()` as follows:
392+
`grpc.NewClient()` as follows:
393393
394394
```go
395395
var opts []grpc.DialOption
396396
...
397-
conn, err := grpc.Dial(*serverAddr, opts...)
397+
conn, err := grpc.NewClient(*serverAddr, opts...)
398398
if err != nil {
399399
...
400400
}
401401
defer conn.Close()
402402
```
403403
404404
You can use `DialOptions` to set the auth credentials (for example, TLS, GCE
405-
credentials, or JWT credentials) in `grpc.Dial` when a service requires them.
406-
The `RouteGuide` service doesn't require any credentials.
405+
credentials, or JWT credentials) in `grpc.NewClient` when a service requires
406+
them. The `RouteGuide` service doesn't require any credentials.
407407
408408
Once the gRPC *channel* is setup, we need a client *stub* to perform RPCs. We
409409
get it using the `NewRouteGuideClient` method provided by the `pb` package

0 commit comments

Comments
 (0)