Documentation
¶
Overview ¶
Package astedit modifies Go source files while keeping their formatting and comments (it uses dave/dst). The maker uses it to add fields and methods to existing entities.
Index ¶
- type File
- func (f *File) AddDecls(src string) error
- func (f *File) AddField(structName, decl, comment string) error
- func (f *File) AddImport(path, name string)
- func (f *File) HasField(structName, field string) bool
- func (f *File) HasMethod(typeName, name string) bool
- func (f *File) Package() string
- func (f *File) Save() error
- func (f *File) Source() ([]byte, error)
- func (f *File) Struct(name string) *dst.StructType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File is a Go source file being edited.
func (*File) AddField ¶
AddField appends a field declaration (e.g. "title string `orm:\"length:200\"`") to the struct, optionally with a doc comment.
Click to show internal directories.
Click to hide internal directories.