Documentation ¶
Overview ¶
Package codegen is a small package intended to help with integrating custom code generation tools in your project. It provides a 5 steps standardized workflow as follows:
- Load a package, parse its source code, produce an AST.
- Scan the loaded package and AST to produce an information tree (custom step).
- Load a (custom) template file and apply it to the extracted information tree.
- Format the generate output through go-imports.
- Save the generated file to disk.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyTemplate ¶
ApplyTemplate loads a template file, executes it on the `data` object, formats the output through go-imports, and save the result alongside the original template file with a .go extension.
Types ¶
type Field ¶
Field captures one fragment of the textual representation of a function argument list, return list or receiver list
type Fields ¶
type Fields []Field
Fields captures all fragments of the textual representation of a function argument list, return list or receiver list
func FieldsFromAST ¶
FieldsFromAST capture the textual components of an ast.FieldList and returns the corresponding codegen.Fields.