callSayHello calls SayHello on c with the given name, and prints the response.
(c hwpb.GreeterClient, name string)
| 38 | // callSayHello calls SayHello on c with the given name, and prints the |
| 39 | // response. |
| 40 | func callSayHello(c hwpb.GreeterClient, name string) { |
| 41 | ctx, cancel := context.WithTimeout(context.Background(), time.Second) |
| 42 | defer cancel() |
| 43 | r, err := c.SayHello(ctx, &hwpb.HelloRequest{Name: name}) |
| 44 | if err != nil { |
| 45 | log.Fatalf("client.SayHello(_) = _, %v", err) |
| 46 | } |
| 47 | fmt.Println("Greeting: ", r.Message) |
| 48 | } |
| 49 | |
| 50 | func callUnaryEcho(client ecpb.EchoClient, message string) { |
| 51 | ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) |