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 NewProtobufNamer() *protobufNamer
- func RewriteGeneratedGogoProtobufFile(name string, packageName string, typeExistsFn func(string) bool, header []byte) error
- func Run(g *Generator)
- type Generator
- type ImportTracker
- func NewImportTracker(local types.Name, types ...*types.Type) *ImportTracker
- func (tracker *ImportTracker) AddNullable()
- func (tracker *ImportTracker) AddType(t *types.Type)
- func (tracker *ImportTracker) AddTypes(types ...*types.Type)
- func (tracker *ImportTracker) ImportLines() []string
- func (tracker *ImportTracker) LocalNameOf(path string) string
- type ProtobufFromGoNamer
- type ProtobufLocator
Functions ¶
func NewProtobufNamer ¶
func NewProtobufNamer() *protobufNamer
func RewriteGeneratedGogoProtobufFile ¶
func RewriteGeneratedGogoProtobufFile(name string, packageName string, typeExistsFn func(string) bool, header []byte) error
func Run ¶
func Run(g *Generator)
Types ¶
type Generator ¶
type Generator struct { Common args.GeneratorArgs Packages string OutputBase string ProtoImport []string Conditional string Clean bool OnlyIDL bool SkipGeneratedRewrite bool DropEmbeddedFields string }
func New ¶
func New() *Generator
func (*Generator) BindFlags ¶
type ImportTracker ¶
type ImportTracker struct {
// contains filtered or unexported fields
}
ImportTracker handles Protobuf package imports
TODO: pay attention to the package name (instead of renaming every package). TODO: Figure out the best way to make names for packages that collide.
func NewImportTracker ¶
func NewImportTracker(local types.Name, types ...*types.Type) *ImportTracker
func (*ImportTracker) AddNullable ¶
func (tracker *ImportTracker) AddNullable()
AddNullable ensures that support for the nullable Gogo-protobuf extension is added.
func (*ImportTracker) AddType ¶
func (tracker *ImportTracker) AddType(t *types.Type)
func (*ImportTracker) AddTypes ¶
func (tracker *ImportTracker) AddTypes(types ...*types.Type)
func (*ImportTracker) ImportLines ¶
func (tracker *ImportTracker) ImportLines() []string
func (*ImportTracker) LocalNameOf ¶
func (tracker *ImportTracker) LocalNameOf(path string) string
LocalNameOf returns the name you would use to refer to the package at the specified path within the body of a file.
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) CastTypeName(name types.Name) string }
Source Files ¶
cmd.go generator.go import_tracker.go namer.go package.go parser.go
- Version
- v1.2.0-alpha.6
- Published
- Jan 13, 2016
- Platform
- js/wasm
- Imports
- 23 packages
- Last checked
- 4 minutes ago –
Tools for package owners.