How to access custom options in Go

299 views
Skip to first unread message

Jungho Ahn

unread,
Nov 12, 2016, 10:42:32 PM11/12/16
to Protocol Buffers
Hello,

I'm using custom options in proto like

extend google.protobuf.MessageOptions {
  MyOption my_option = 10000;
}
message MyOption { string name = 1; }

message MyMessage {
  option (my_option).name = 'snaps';
  ...
}

I can access this option by getting extension of the message descriptor in Java.
But I couldn't a way to do in Go. I saw the same issue in https://github.com/golang/protobuf/issues/179, but couldn't find answer.

Is this not supported in Go?

Thanks,


Travis Cline

unread,
Nov 14, 2016, 8:34:07 PM11/14/16
to Protocol Buffers

Jungho Ahn

unread,
Nov 14, 2016, 9:50:47 PM11/14/16
to Travis Cline, Protocol Buffers
Thanks, but I think I need to get the descriptor of a message and then get the extension of the descriptor.
 


-tmc

On Saturday, November 12, 2016 at 7:42:32 PM UTC-8, Jungho Ahn wrote:
Hello,

I'm using custom options in proto like

extend google.protobuf.MessageOptions {
  MyOption my_option = 10000;
}
message MyOption { string name = 1; }

message MyMessage {
  option (my_option).name = 'snaps';
  ...
}

I can access this option by getting extension of the message descriptor in Java.
But I couldn't a way to do in Go. I saw the same issue in https://github.com/golang/protobuf/issues/179, but couldn't find answer.

Is this not supported in Go?

Thanks,


--
You received this message because you are subscribed to a topic in the Google Groups "Protocol Buffers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/protobuf/0nmtlIhDW_0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to protobuf+unsubscribe@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.



--
Jungho
Reply all
Reply to author
Forward
0 new messages