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

Function main

examples/helloworld/greeter_client/main.go:42–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40)
41
42func main() {
43 flag.Parse()
44 // Set up a connection to the server.
45 conn, err := grpc.NewClient(*addr, grpc.WithTransportCredentials(insecure.NewCredentials()))
46 if err != nil {
47 log.Fatalf("did not connect: %v", err)
48 }
49 defer conn.Close()
50 c := pb.NewGreeterClient(conn)
51
52 // Contact the server and print out its response.
53 ctx, cancel := context.WithTimeout(context.Background(), time.Second)
54 defer cancel()
55 r, err := c.SayHello(ctx, &pb.HelloRequest{Name: *name})
56 if err != nil {
57 log.Fatalf("could not greet: %v", err)
58 }
59 log.Printf("Greeting: %s", r.GetMessage())
60}

Callers

nothing calls this directly

Calls 9

SayHelloMethod · 0.95
NewClientFunction · 0.92
WithTransportCredentialsFunction · 0.92
NewCredentialsFunction · 0.92
ParseMethod · 0.65
FatalfMethod · 0.65
CloseMethod · 0.65
PrintfMethod · 0.65
GetMessageMethod · 0.45

Tested by

no test coverage detected