Documentation ¶
Index ¶
- func Files(path string, acceptExt string) ([]string, error)
- func FindIllegalStatements(sourceFile string, sourceData []byte) (_ []int, _ []Undo, _ []Undo, rErr error)
- func InsertImport(node *ast.File, alias *string, path string)
- func RandSeq(n int) string
- func RemoveComments(tempFile string) error
- func Report(err error) (exitCode int)
- type Undo
- type UndoType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Files ¶
Files accepts a path and returns a slice containing the path or paths (if path is a directory). acceptExt is used to filter specific file extensions.
func FindIllegalStatements ¶
func FindIllegalStatements(sourceFile string, sourceData []byte) (_ []int, _ []Undo, _ []Undo, rErr error)
FindIllegalStatements will search for these illegal statements: - "defer go" - "fordefer" and "fordefer go" (inside for loops) The function returns where the "go" statements are (before temporary removal) The function also returns where the "fordefer" statements are and whether they were next to a "go" statement.
func InsertImport ¶
InsertImport will add an import declaration to a file (if it doesn't exist already).
func RemoveComments ¶
RemoveComments will remove comments found inside functions to prevent interference when tree nodes are removed or manipulated.