title: protobuf: how to parse descriptor message from FieldOptions
body: <p>I have a proto file below</p>
  
  <pre><code>syntax = "proto2";
  package cmd;
  
  import "google/protobuf/descriptor.proto";
  
  message FlagDetail {
    required string name = 1;
    required string value = 2;
    required string shorthand = 3;
    required string usage = 4;
  }
  
  extend google.protobuf.FieldOptions {
    optional FlagDetail info = 1234;
  }
  
  message VersionFlags {
    optional bool client = 2 [ (info) = { name: "client" value: "false" shorthand: "c" usage: "Client version only (no server required)."}];
    optional bool short = 3  [ (info) = { name: "short" value: "false" shorthand: "baz" usage: "Print just the version number."}];
    optional string output = 4 [ (info) = { name: "output" value: "" shorthand: "o" usage: "One of 'yaml' or 'json'."}];
  }
  </code></pre>
  
  <p>How to a get an empty message's default value of FlagDetail</p>
  
  <p>some thing like this</p>
  
  <pre><code>var msg VersionFlags
  md := ForMessage(&amp;msg)  
  o := md.Field[0].GetOptions()
  o.GetFlagDetail.GetName()  //unfortunately, there's no method like this
  </code></pre>
  
  <p>BTW  ForMessage() is from here : <a href="https://github.com/golang/protobuf/blob/master/descriptor/descriptor_test.go" rel="nofollow noreferrer">https://github.com/golang/protobuf/blob/master/descriptor/descriptor_test.go</a></p>
  
  <p>here is my proto file <a href="https://gist.githubusercontent.com/shiywang/3d9f53fe253bb4195d65b3626442cb66/raw/89c286599a4103f67b80a62c87c69847497fa289/protofile" rel="nofollow noreferrer">https://gist.githubusercontent.com/shiywang/3d9f53fe253bb4195d65b3626442cb66/raw/89c286599a4103f67b80a62c87c69847497fa289/protofile</a></p>