diff --git a/cmd/protoc-gen-go-grpc/internal_gengogrpc/grpc.go b/cmd/protoc-gen-go-grpc/internal_gengogrpc/grpc.go index 13dd7684..dff08776 100644 --- a/cmd/protoc-gen-go-grpc/internal_gengogrpc/grpc.go +++ b/cmd/protoc-gen-go-grpc/internal_gengogrpc/grpc.go @@ -150,7 +150,7 @@ func genService(gen *protogen.Plugin, file *protogen.File, g *protogen.Generated continue } g.P("{") - g.P("MethodName: ", strconv.Quote(method.GoName), ",") + g.P("MethodName: ", strconv.Quote(string(method.Desc.Name())), ",") g.P("Handler: ", handlerNames[i], ",") g.P("},") } @@ -161,7 +161,7 @@ func genService(gen *protogen.Plugin, file *protogen.File, g *protogen.Generated continue } g.P("{") - g.P("StreamName: ", strconv.Quote(method.GoName), ",") + g.P("StreamName: ", strconv.Quote(string(method.Desc.Name())), ",") g.P("Handler: ", handlerNames[i], ",") if method.Desc.IsStreamingServer() { g.P("ServerStreams: true,") @@ -298,7 +298,7 @@ func genServerMethod(gen *protogen.Plugin, file *protogen.File, g *protogen.Gene g.P("if interceptor == nil { return srv.(", service.GoName, "Server).", method.GoName, "(ctx, in) }") g.P("info := &", grpcPackage.Ident("UnaryServerInfo"), "{") g.P("Server: srv,") - g.P("FullMethod: ", strconv.Quote(fmt.Sprintf("/%s/%s", service.Desc.FullName(), method.Desc.Name())), ",") + g.P("FullMethod: ", strconv.Quote(fmt.Sprintf("/%s/%s", service.Desc.FullName(), method.GoName)), ",") g.P("}") g.P("handler := func(ctx ", contextPackage.Ident("Context"), ", req interface{}) (interface{}, error) {") g.P("return srv.(", service.GoName, "Server).", method.GoName, "(ctx, req.(*", method.InputType.GoIdent, "))") diff --git a/cmd/protoc-gen-go-grpc/testdata/grpc/grpc_grpc.pb.go b/cmd/protoc-gen-go-grpc/testdata/grpc/grpc_grpc.pb.go index 48c4abd5..b638f8c6 100644 --- a/cmd/protoc-gen-go-grpc/testdata/grpc/grpc_grpc.pb.go +++ b/cmd/protoc-gen-go-grpc/testdata/grpc/grpc_grpc.pb.go @@ -167,7 +167,7 @@ func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, dec fu } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/goproto.protoc.grpc.test_service/unary_call", + FullMethod: "/goproto.protoc.grpc.test_service/UnaryCall", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(TestServiceServer).UnaryCall(ctx, req.(*Request)) @@ -253,23 +253,23 @@ var _TestService_serviceDesc = grpc.ServiceDesc{ HandlerType: (*TestServiceServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "UnaryCall", + MethodName: "unary_call", Handler: _TestService_UnaryCall_Handler, }, }, Streams: []grpc.StreamDesc{ { - StreamName: "DownstreamCall", + StreamName: "downstream_call", Handler: _TestService_DownstreamCall_Handler, ServerStreams: true, }, { - StreamName: "UpstreamCall", + StreamName: "upstream_call", Handler: _TestService_UpstreamCall_Handler, ClientStreams: true, }, { - StreamName: "BidiCall", + StreamName: "bidi_call", Handler: _TestService_BidiCall_Handler, ServerStreams: true, ClientStreams: true,