Skip to content

Instantly share code, notes, and snippets.

@RicardoLinck
Created June 25, 2020 21:49
Show Gist options
  • Save RicardoLinck/84c9c0772f8891c6fadf267337071485 to your computer and use it in GitHub Desktop.
Save RicardoLinck/84c9c0772f8891c6fadf267337071485 to your computer and use it in GitHub Desktop.
func sum(c calculatorpb.CalculatorServiceClient) {
req := &calculatorpb.SumRequest{
NumA: 3,
NumB: 10,
}
ctx := metadata.AppendToOutgoingContext(context.Background(), "user", "test")
res, err := c.Sum(ctx, req)
if err != nil {
log.Fatalf("Error calling Sum RPC: %v", err)
}
log.Printf("Response: %d\n", res.Result)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment