3 ms·
Even though I think Go's GRPC implementation is pretty good, this is something that really annoys me about the way it's designed. The interface of a GRPC client
by EdSchouten 7y ago
Even though I think Go's GRPC implementation is pretty good, this is something that really annoys me about the way it's designed. The interface of a GRPC client is not the same as the interface of a GRPC server. This means that:
- You cannot instantiate a piece of code built on top of a GRPC client directly on top of another piece of code that implements a GRPC service. You will need to create a full GRPC client and server. Don't want to let them communicate over an OS-level socket? You'll have to use something like https://godoc.org/google.golang.org/grpc/test/bufconn https://godoc.org/google.golang.org/grpc/test/bufconn to create an in-memory socket.
- You cannot let a GRPC server process forward requests to a GRPC client directly. Quite annoying in case you want to multiplex requests, add an authenticating proxy, etc. etc.
- Unit testing a GRPC service is annoying, as the service implementation has to take some concrete GRPC types that can only be instantiated by a GRPC server. This means that you also have to create a full GRPC client/server/bufconn to be able to test it.