Documentation
¶
Index ¶
- func CreateField(name string, fieldType ast.Expr) *ast.Field
- func CreateSourceCode(astFile *ast.File) ([]byte, error)
- func DirToImport(p string) (string, error)
- func EachDeclarationInFile(file *ast.File) <-chan ast.Decl
- func EachFieldInFieldList(fieldList *ast.FieldList) <-chan *ast.Field
- func EachGenericDeclarationInFile(file *ast.File) <-chan *ast.GenDecl
- func EachSpecificationInGenericDeclaration(decl *ast.GenDecl) <-chan ast.Spec
- func EachTypeSpecificationInFile(file *ast.File) <-chan *ast.TypeSpec
- func EachTypeSpecificationInGenericDeclaration(decl *ast.GenDecl) <-chan *ast.TypeSpec
- func FieldTypeReuseCount(field *ast.Field) int
- func FieldsAsAnonymous(fields []*ast.Field) []*ast.Field
- func FieldsWithoutEllipsis(fields []*ast.Field) []*ast.Field
- func FixSourceCodeImports(original []byte) ([]byte, error)
- func FormatSourceCode(original []byte) ([]byte, error)
- func ImportToDir(imp string) (string, error)
- func SaveSourceCode(filePath string, sourceCode []byte) error
- func SnakeCase(text string) string
- func ToPrivate(name string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirToImport ¶
DirToImport converts a directory path on the local machine to a Go import path (usually relative to the $GOPATH/src directory)
For example,
/Users/user/workspace/Go/github.com/mokiat/gostub
will be converted to
github.com/mokiat/gostub
should GOPATH include the location
/Users/user/workspace/Go
func FieldTypeReuseCount ¶
func FixSourceCodeImports ¶
func FormatSourceCode ¶
func ImportToDir ¶
ImportToDir converts an import location to a directory path on the local machine.
For example,
github.com/mokiat/gostub
will be converted to
/Users/user/workspace/Go/github.com/mokiat/gostub
should GOPATH be equal to
/Users/user/workspace/Go
func SaveSourceCode ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.