Recently, grpc-go introduced the mustEmbedUnimplemented*** method. It is used for forward compatibility.
In simple terms, I am unable to understand how it is helping and how earlier without it what problems we were facing? In my structs now I use to add the following statement but, I don't know why...
type server struct {
pdfpb.UnimplementedGreetServiceServer
}
In Github issue - https://github.com/grpc/grpc-go/issues/3669 they debated over it, can someone please explain in simple terms how it is helping and how earlier without it what problems we were facing?
That was quite basic.
UnimplementedGreetServiceServer
is a struct with all implemented methods.When I add
pdfpb.UnimplementedGreetServiceServer
I am able to callUnimplementedGreetServiceServer
defined methods.That's how, if I add more RPC services in the proto file, then I don't need to add all RPC methods leading to forward compatibility.
Demo code is available at: https://github.com/parthw/fun-coding/tree/main/golang/understanding-grpc-change