kubernetes/staging/src/k8s.io/code-generator/cmd/defaulter-gen/generators/defaulter.go

var typeZeroValue

const tagName

const inputTagName

const defaultTagName

func extractDefaultTag(comments []string) []string {}

func extractTag(comments []string) []string {}

func extractInputTag(comments []string) []string {}

func checkTag(comments []string, require ...string) bool {}

func defaultFnNamer() *namer.NameStrategy {}

func objectDefaultFnNamer() *namer.NameStrategy {}

// NameSystems returns the name system used by the generators in this package.
func NameSystems() namer.NameSystems {}

// DefaultNameSystem returns the default name system for ordering the types to be
// processed by the generators in this package.
func DefaultNameSystem() string {}

type defaults

type defaulterFuncMap

// Returns all manually-defined defaulting functions in the package.
func getManualDefaultingFunctions(context *generator.Context, pkg *types.Package, manualMap defaulterFuncMap) {}

func GetTargets(context *generator.Context, args *args.Args) []generator.Target {}

type callTreeForType

func newCallTreeForType(existingDefaulters, newDefaulters defaulterFuncMap) *callTreeForType {}

// resolveType follows pointers and aliases of `t` until reaching the first
// non-pointer type in `t's` herarchy
func resolveTypeAndDepth(t *types.Type) (*types.Type, int) {}

// getPointerElementPath follows pointers and aliases to returns all
// pointer elements in the path from the given type, to its base value type.
//
// Example:
//
//	type MyString string
//	type MyStringPointer *MyString
//	type MyStringPointerPointer *MyStringPointer
//	type MyStringAlias MyStringPointer
//	type MyStringAliasPointer *MyStringAlias
//	type MyStringAliasDoublePointer **MyStringAlias
//
//	t		  				   | defaultPointerElementPath(t)
//	---------------------------|----------------------------------------
//	MyString                   | []
//	MyStringPointer            | [MyString]
//	MyStringPointerPointer     | [MyStringPointer, MyString]
//	MyStringAlias              | [MyStringPointer, MyString]
//	MyStringAliasPointer       | [MyStringAlias, MyStringPointer, MyString]
//	MyStringAliasDoublePointer | [*MyStringAlias, MyStringAlias, MyStringPointer, MyString]
func getPointerElementPath(t *types.Type) []*types.Type {}

// getNestedDefault returns the first default value when resolving alias types
func getNestedDefault(t *types.Type) string {}

var refRE

var refREIdentIndex

// parseSymbolReference looks for strings that match one of the following:
//   - ref(Ident)
//   - ref(pkgpath.Ident)
//     If the input string matches either of these, it will return the (optional)
//     pkgpath, the Ident, and true.  Otherwise it will return empty strings and
//     false.
func parseSymbolReference(s, sourcePackage string) (types.Name, bool) {}

func populateDefaultValue(node *callNode, t *types.Type, tags string, commentLines []string, commentPackage string) *callNode {}

// build creates a tree of paths to fields (based on how they would be accessed in Go - pointer, elem,
// slice, or key) and the functions that should be invoked on each field. An in-order traversal of the resulting tree
// can be used to generate a Go function that invokes each nested function on the appropriate type. The return
// value may be nil if there are no functions to call on type or the type is a primitive (Defaulters can only be
// invoked on structs today). When root is true this function will not use a newDefaulter. existingDefaulters should
// contain all defaulting functions by type defined in code - newDefaulters should contain all object defaulters
// that could be or will be generated. If newDefaulters has an entry for a type, but the 'object' field is nil,
// this function skips adding that defaulter - this allows us to avoid generating object defaulter functions for
// list types that call empty defaulters.
func (c *callTreeForType) build(t *types.Type, root bool) *callNode {}

const runtimePackagePath

const conversionPackagePath

type genDefaulter

func NewGenDefaulter(outputFilename, typesPackage, outputPackage string, existingDefaulters, newDefaulters defaulterFuncMap, peerPkgs []string) generator.Generator {}

func (g *genDefaulter) Namers(c *generator.Context) namer.NameSystems {}

func (g *genDefaulter) isOtherPackage(pkg string) bool {}

func (g *genDefaulter) Filter(c *generator.Context, t *types.Type) bool {}

func (g *genDefaulter) Imports(c *generator.Context) (imports []string) {}

func (g *genDefaulter) Init(c *generator.Context, w io.Writer) error {}

func (g *genDefaulter) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error {}

func defaultingArgsFromType(inType *types.Type) generator.Args {}

func (g *genDefaulter) generateDefaulter(c *generator.Context, inType *types.Type, callTree *callNode, sw *generator.SnippetWriter) {}

type callNode

type defaultValue

func (d defaultValue) IsEmpty() bool {}

func (d defaultValue) Resolved() string {}

type CallNodeVisitorFunc

func (n *callNode) VisitInOrder(fn CallNodeVisitorFunc) {}

func (n *callNode) visitInOrder(ancestors []*callNode, fn CallNodeVisitorFunc) {}

var indexVariables

var localVariables

// varsForDepth creates temporary variables guaranteed to be unique within lexical Go scopes
// of this depth in a function. It uses canonical Go loop variables for the first 7 levels
// and then resorts to uglier prefixes.
func varsForDepth(depth int) (index, local string) {}

// writeCalls generates a list of function calls based on the calls field for the provided variable
// name and pointer.
func (n *callNode) writeCalls(varName string, isVarPointer bool, sw *generator.SnippetWriter) {}

func getTypeZeroValue(t string) (interface{}

func (n *callNode) writeDefaulter(c *generator.Context, varName string, index string, isVarPointer bool, sw *generator.SnippetWriter) {}

// WriteMethod performs an in-order traversal of the calltree, generating loops and if blocks as necessary
// to correctly turn the call tree into a method body that invokes all calls on all child nodes of the call tree.
// Depth is used to generate local variables at the proper depth.
func (n *callNode) WriteMethod(c *generator.Context, varName string, depth int, ancestors []*callNode, sw *generator.SnippetWriter) {}

type callPath

// String prints a representation of a callPath that roughly approximates what a Go accessor
// would look like. Used for debugging only.
func (path callPath) String() string {}