>From what I know, a) with the normal protobuf package, you can not en- or
decode and then reflect messages by the proto descriptor, you need to
compile in the generated code - adding methods to a reflect-created struct
alone doesn't help, as the package also has some assumptions about the
representation of the type, from what I can tell. And b) you can not invoke
reflected RPC calls with the go grpc implementation. Related issues are
https://github.com/golang/protobuf/issues/199
https://github.com/grpc/grpc-go/issues/866

On Thu, Feb 23, 2017 at 1:16 PM, Ivan Vučica <ivuc...@gmail.com> wrote:

> What I want, in the end, is to send a gRPC request based on an ASCII or
> JSON representation of a protobuf, receive a response and display it.
>
> Essentially, if you take grpc_cli tool present in the repo of C
> implementation of gRPC, I would like to implement its "call" functionality.
>
> Even though trying to construct a binary protobuf /might/ be a dead end
> depending on how I would have to invoke the RPC itself, building a
> proto.Message out of a remote protobuf descriptor happens to be an
> interesting problem in itself.
>
> It'd be less than fun if the solution is to write yet another proto
> serializer/deserializer. And I didn't even check if, when using grpc-go, I
> can invoke a remote gRPC method using just its name...
>
> Of course, if you have another shortcut that I missed in grpc-go's APIs or
> in Go protobuf's APIs, that'd be great, too ☺️
>
> On Thu, Feb 23, 2017, 02:57 Matt Harden <matt.har...@gmail.com> wrote:
>
>> Is the intermediate Go struct necessary, or do you just want to convert a
>> text proto to a binary representation?
>>
>> On Wed, Feb 22, 2017 at 6:10 PM <ivuc...@gmail.com> wrote:
>>
>> Hi,
>>
>> I'm fiddling with gRPC and its service reflection. I discovered a neat
>> package (github.com/jhump/protoreflect) that let me quickly enumerate
>> the services that are exposed by the gRPC server, the RPCs that are in
>> those gRPC services, and finally the proto messages that are used as inputs
>> and outputs.
>>
>> Later, I'll worry about how to actually send out the RPC.
>>
>> For now, I'm trying to unserialize a text proto message into a
>> dynamically constructed Go struct, which I'd then serialize back into a
>> binary proto.
>>
>> I'd like to make the generated struct satisfy the proto.Message
>> interface. There are three methods required by that interface.
>>
>> How would one go about attaching the required methods onto the newly
>> constructed type?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to golang-nuts+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to