Documentation
¶
Index ¶
- Variables
- func DiscoverList(list []*ast.Field) []*ast.Field
- func DiscoverType(express ast.Expr) ast.Expr
- type CommentVisitor
- type ConstVisitor
- type StructChanger
- type StructCopier
- type Tree
- func (gt *Tree) AddHelloMainFunc()
- func (gt *Tree) AddImport(imp string)
- func (gt *Tree) AddImportSection(imports []string)
- func (gt *Tree) Bytes(doFormat bool) ([]byte, error)
- func (gt *Tree) ChangeConstString(varName string, varValue string) error
- func (gt *Tree) ChangeStruct(varName string, varValue []*ast.Field, varComments *ast.CommentGroup) error
- func (gt *Tree) PrintComments() error
- func (gt *Tree) SetPackageName(name string)
- func (gt *Tree) StructFields(varName string) ([]*ast.Field, *ast.CommentGroup, error)
- func (gt *Tree) WriteFile(filepath string, doFormat bool, dirPerm os.FileMode, filePerm os.FileMode) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrVarMustString = errors.New("variable type must be a string") ErrVarNotFound = errors.New("variable not found") )
Functions ¶
func DiscoverList ¶
DiscoverList builds clean lists for ast
Types ¶
type CommentVisitor ¶
type CommentVisitor struct {
Tree *Tree
}
type ConstVisitor ¶
type StructChanger ¶
type StructCopier ¶
type Tree ¶
func (*Tree) AddHelloMainFunc ¶
func (gt *Tree) AddHelloMainFunc()
AddHelloMainFunc adds a main func the outputs: hello world
func (*Tree) AddImportSection ¶
AddImport adds an import section with import paths
func (*Tree) ChangeConstString ¶
ChangeConstString changes the value of a named const
func (*Tree) ChangeStruct ¶
func (gt *Tree) ChangeStruct(varName string, varValue []*ast.Field, varComments *ast.CommentGroup) error
ChangeStruct changes the struct field list
func (*Tree) PrintComments ¶
PrintComments prints all the comments and locations
func (*Tree) SetPackageName ¶
SetPackageName sets the package name
func (*Tree) StructFields ¶
StructFields returns the struct fields
Click to show internal directories.
Click to hide internal directories.