Skip to content

Commit

Permalink
Update Go example in Quickstart of README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
julieqiu authored Sep 23, 2024
1 parent 8a91e64 commit 92b4ab3
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,34 @@ const client = new showcase.EchoClient({ grpc, sslCreds: grpc.credentials.create
#### Example for Go:
```go
conn, err := grpc.Dial("localhost:7469", grpc.WithInsecure())
if err != nil {
log.Fatal(err)
}
opt := option.WithGRPCConn(conn)
client, err = showcase.NewEchoClient(context.Background(), opt)
if err != nil {
log.Fatal(err)
package main
import (
"context"
"fmt"
"log"
"github.com/googleapis/gapic-showcase/client"
"google.golang.org/api/option"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)
func main() {
conn, err := grpc.Dial("localhost:7469", grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
log.Fatal(err)
}
opt := option.WithGRPCConn(conn)
ctx := context.Background()
_, err = client.NewEchoClient(ctx, opt)
if err != nil {
log.Fatal(err)
}
}
```
#### Example for Java (gRPC):
```java
Expand Down

0 comments on commit 92b4ab3

Please sign in to comment.