Skip to content

Instantly share code, notes, and snippets.

@TonPC64
Created February 24, 2022 14:49
Show Gist options
  • Save TonPC64/475a15213297037559c6724539ae60ea to your computer and use it in GitHub Desktop.
Save TonPC64/475a15213297037559c6724539ae60ea to your computer and use it in GitHub Desktop.
func callSayHello(ctx context.Context, c api.HelloServiceClient) {
md := metadata.Pairs(
"timestamp", time.Now().Format(time.StampNano),
)
ctx = metadata.NewOutgoingContext(ctx, md)
response, err := c.SayHello(ctx, &api.HelloRequest{Greeting: "World"})
if err != nil {
log.Fatalf("Error when calling SayHello: %s", err)
}
log.Printf("Response from server: %s", response.Reply)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment