Skip to content

Instantly share code, notes, and snippets.

@RicardoLinck
Created June 25, 2020 21:48
Show Gist options
  • Save RicardoLinck/9a2ec04125774c2c918ed68ad6f701c4 to your computer and use it in GitHub Desktop.
Save RicardoLinck/9a2ec04125774c2c918ed68ad6f701c4 to your computer and use it in GitHub Desktop.
func (*server) Sum(ctx context.Context, req *calculatorpb.SumRequest) (*calculatorpb.SumResponse, error) {
log.Printf("Sum rpc invoked with req: %v\n", req)
md, _ := metadata.FromIncomingContext(ctx)
log.Printf("Metadata received: %v", md)
return &calculatorpb.SumResponse{
Result: req.NumA + req.NumB,
}, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment