package protobuf
import "k8s.io/kubernetes/cmd/libs/go2idl/go-to-protobuf/protobuf"
go-to-protobuf generates a Protobuf IDL from a Go struct, respecting any existing IDL tags on the Go struct.
Index ¶
- func NewProtoFile() *generator.DefaultFileType
- func NewProtobufNamer() *protobufNamer
- func RewriteGeneratedGogoProtobufFile(name string, extractFn ExtractFunc, optionalFn OptionalFunc, header []byte) error
- func RewriteTypesWithProtobufStructTags(name string, structTags map[string]map[string]string) error
- func Run(g *Generator)
- type ExtractFunc
- type Generator
- type ImportTracker
- func NewImportTracker(local types.Name, typesToAdd ...*types.Type) *ImportTracker
- func (tracker *ImportTracker) AddNullable()
- type OptionalFunc
- type ProtobufFromGoNamer
- type ProtobufLocator
Functions ¶
func NewProtoFile ¶
func NewProtoFile() *generator.DefaultFileType
func NewProtobufNamer ¶
func NewProtobufNamer() *protobufNamer
func RewriteGeneratedGogoProtobufFile ¶
func RewriteGeneratedGogoProtobufFile(name string, extractFn ExtractFunc, optionalFn OptionalFunc, header []byte) error
func RewriteTypesWithProtobufStructTags ¶
func Run ¶
func Run(g *Generator)
Types ¶
type ExtractFunc ¶
ExtractFunc extracts information from the provided TypeSpec and returns true if the type should be removed from the destination file.
type Generator ¶
type Generator struct { Common args.GeneratorArgs Packages string OutputBase string ProtoImport []string Conditional string Clean bool OnlyIDL bool KeepGogoproto bool SkipGeneratedRewrite bool DropEmbeddedFields string }
func New ¶
func New() *Generator
func (*Generator) BindFlags ¶
type ImportTracker ¶
type ImportTracker struct { namer.DefaultImportTracker }
func NewImportTracker ¶
func NewImportTracker(local types.Name, typesToAdd ...*types.Type) *ImportTracker
func (*ImportTracker) AddNullable ¶
func (tracker *ImportTracker) AddNullable()
AddNullable ensures that support for the nullable Gogo-protobuf extension is added.
type OptionalFunc ¶
OptionalFunc returns true if the provided local name is a type that has protobuf.nullable=true and should have its marshal functions adjusted to remove the 'Items' accessor.
type ProtobufFromGoNamer ¶
ProtobufFromGoNamer finds the protobuf name of a type (and its package, and the package path) from its Go name.
type ProtobufLocator ¶
type ProtobufLocator interface { ProtoTypeFor(t *types.Type) (*types.Type, error) GoTypeForName(name types.Name) *types.Type CastTypeName(name types.Name) string }
Source Files ¶
cmd.go generator.go import_tracker.go namer.go package.go parser.go tags.go
- Version
- v1.5.4-beta.0
- Published
- Feb 15, 2017
- Platform
- js/wasm
- Imports
- 26 packages
- Last checked
- 9 minutes ago –
Tools for package owners.