cmd/protoc-gen-go-grpc: revert to interface-based service registration (#3911)

This commit is contained in:
Doug Fawley
2020-09-29 15:17:06 -07:00
committed by GitHub
parent e6c98a478e
commit 02cd07d9bb
68 changed files with 2021 additions and 2555 deletions

View File

@ -130,8 +130,12 @@ func (cs *certStore) loadCerts() error {
return nil
}
type greeterServer struct {
pb.UnimplementedGreeterServer
}
// sayHello is a simple implementation of the pb.GreeterServer SayHello method.
func sayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) {
func (greeterServer) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) {
return &pb.HelloReply{Message: "Hello " + in.Name}, nil
}
@ -408,7 +412,7 @@ func (s) TestEnd2End(t *testing.T) {
t.Fatalf("failed to listen: %v", err)
}
defer lis.Close()
pb.RegisterGreeterService(s, &pb.GreeterService{SayHello: sayHello})
pb.RegisterGreeterServer(s, greeterServer{})
go s.Serve(lis)
clientOptions := &ClientOptions{
IdentityOptions: IdentityCertificateOptions{