(ctx context.Context, req *EchoRequest)
| 17 | } |
| 18 | |
| 19 | func (srv *EchoServer) Echo(ctx context.Context, req *EchoRequest) (*EchoReply, error) { |
| 20 | msg := req.Text |
| 21 | switch { |
| 22 | case msg == "noecho": |
| 23 | return nil, ErrCantEcho |
| 24 | case len(msg) > 10: |
| 25 | return nil, errors.WithMessage(ErrTooLong, msg+" is too long") |
| 26 | case msg == "reverse": |
| 27 | return nil, status.Error(codes.Unimplemented, "reverse is not implemented") |
| 28 | case msg == "internal": |
| 29 | return nil, status.WrapErr(codes.Internal, "there was a problem", ErrInternal) |
| 30 | } |
| 31 | return &EchoReply{ |
| 32 | Reply: "echoing: " + msg, |
| 33 | }, nil |
| 34 | } |
nothing calls this directly
no test coverage detected