code-generator: Files | Directories

Command defaulter-gen

defaulter-gen is a tool for auto-generating Defaulter functions.

Given a list of input directories, it will scan for top level types and generate efficient defaulters for an entire object from the sum of the SetDefault_* methods contained in the object tree.

Generation is governed by comment tags in the source. Any package may request defaulter generation by including one or more comment tags at the package comment level:

// +k8s:defaulter-gen=<field-name-to-flag>

which will create defaulters for any type that contains the provided field name (if the type has defaulters). Any type may request explicit defaulting by providing the comment tag:

// +k8s:defaulter-gen=true|false

An existing defaulter method (`SetDefaults_TYPE`) can provide the comment tag:

// +k8s:defaulter-gen=covers

to indicate that the defaulter does not or should not call any nested defaulters.

Package Files




Package main imports 8 packages (graph). Updated 2019-01-21. Refresh now. Tools for package owners.