MCPcopy
hub / github.com/grpc/grpc-go / callSayHello

Function callSayHello

examples/features/multiplex/client/main.go:40–48  ·  view source on GitHub ↗

callSayHello calls SayHello on c with the given name, and prints the response.

(c hwpb.GreeterClient, name string)

Source from the content-addressed store, hash-verified

38// callSayHello calls SayHello on c with the given name, and prints the
39// response.
40func 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
50func callUnaryEcho(client ecpb.EchoClient, message string) {
51 ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)

Callers 1

mainFunction · 0.85

Calls 3

PrintlnMethod · 0.80
SayHelloMethod · 0.65
FatalfMethod · 0.65

Tested by

no test coverage detected