Kyle Lemons <
kev...@google.com> writes:
> On Wed, Sep 12, 2012 at 7:35 AM, Sebastien Binet <
seb....@gmail.com>wrote:
>
>> Kyle,
>>
>> > If you use the self describing proto to which you linked, you can get the
>> > FileDescriptorProto from "protoc -oFILE" and then decoding that file.
>> You
>> > can see the source for
>> > protoc-gen-go<
>>
https://code.google.com/p/goprotobuf/source/browse/#hg/protoc-gen-go>if
>> > you want to see how the code is generated or re-wrap it.
>>
>> thanks, that helped me bootstrap my scaffolding.
>>
>> I noticed that once one enables the filedescriptor generation, one gets
>> this dubious go-import in the xyz.pb.go file:
>>
>> import google_protobuf "google/protobuf/descriptor.pb"
>>
>
> That, I believe, is based on the import in your self-describing proto
> file.
I have this little template:
``` go
const pb_pkg_templ = `package {{.Package}};
import "google/protobuf/descriptor.proto";
message {{.Message}} {
extensions 50000 to max;
{{with .Fields}}
{{range .}} {{.Modifier}} {{.Type}} {{.Name}} = {{.Id}}{{.Attr}};
{{end}}
{{end}}
}
extend google.protobuf.FieldOptions {
optional string root_branch = 50002;
}
message DataHeader {
// Set of .proto files which define the type.
required google.protobuf.FileDescriptorSet proto_files = 1;
// number of entries in the payload message
required int64 NbrEntries = 2;
}
`
```
which looks like what you pointed at...
-s