diff --git a/examples/features/retry/client/main.go b/examples/features/retry/client/main.go index 9f76f9dc3..179f65c0f 100644 --- a/examples/features/retry/client/main.go +++ b/examples/features/retry/client/main.go @@ -47,16 +47,14 @@ var ( }]}` ) -// use grpc.WithDefaultServiceConfig() to set service config -func retryDial() (*grpc.ClientConn, error) { - return grpc.NewClient(*addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDefaultServiceConfig(retryPolicy)) -} - func main() { flag.Parse() - // Set up a connection to the server. - conn, err := retryDial() + // Set up a connection to the server with service config and create the channel. + // However, the recommended approach is to fetch the retry configuration + // (which is part of the service config) from the name resolver rather than + // defining it on the client side. + conn, err := grpc.NewClient(*addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDefaultServiceConfig(retryPolicy)) if err != nil { log.Fatalf("did not connect: %v", err) }