Documentation ¶
Index ¶
- func CreateGenRequest(fds *descriptor.FileDescriptorSet, filesToGen ...string) *plugin_go.CodeGeneratorRequest
- func FilesToGenerate(req *plugin_go.CodeGeneratorRequest) []*descriptor.FileDescriptorProto
- func FindDescriptor(set *descriptor.FileDescriptorSet, name string) *descriptor.FileDescriptorProto
- func InStringSlice(sl []string, val string) bool
- func LoadDescriptor(name string, pathSegments ...string) (*descriptor.FileDescriptorProto, error)
- func LoadDescriptorSet(pathSegments ...string) (*descriptor.FileDescriptorSet, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateGenRequest ¶
func CreateGenRequest(fds *descriptor.FileDescriptorSet, filesToGen ...string) *plugin_go.CodeGeneratorRequest
CreateGenRequest creates a codegen request from a `FileDescriptorSet`
func FilesToGenerate ¶
func FilesToGenerate(req *plugin_go.CodeGeneratorRequest) []*descriptor.FileDescriptorProto
FilesToGenerate iterates through the proto files in the request and returns only the ones that were requested on the command line. Only these protos should be generated by a codegen plugin.
func FindDescriptor ¶
func FindDescriptor(set *descriptor.FileDescriptorSet, name string) *descriptor.FileDescriptorProto
FindDescriptor finds the named descriptor in the given set. Only base names are searched. The first match is returned, on `nil` if not found
func InStringSlice ¶
InStringSlice returns whether or not the supplied value is in the slice
func LoadDescriptor ¶
func LoadDescriptor(name string, pathSegments ...string) (*descriptor.FileDescriptorProto, error)
LoadDescriptor loads file descriptor protos from a file on disk, and returns the named proto descriptor. This is useful mostly for testing purposes.
func LoadDescriptorSet ¶
func LoadDescriptorSet(pathSegments ...string) (*descriptor.FileDescriptorSet, error)
LoadDescriptorSet loads a `FileDescriptorSet` from a file on disk. Such a file can be generated using the `--descriptor_set_out` flag with `protoc`.
Example:
protoc --descriptor_set_out=fileset.pb --include_imports --include_source_info ./booking.proto ./todo.proto
Types ¶
This section is empty.