Documentation ¶
Index ¶
- Variables
- func AddArgToCallExpr(df *dst.File, scope Scope, funcName string, arg dst.Expr, pos int) (modified bool)
- func AddEmptyLineIntoFuncBody(df *dst.File, funcName string) (modified bool)
- func AddFieldToFuncDeclParams(df *dst.File, funcName string, field *dst.Field, pos int) (modified bool)
- func AddFieldToFuncLitParams(df *dst.File, scope Scope, field *dst.Field, pos int) (modified bool)
- func AddStmtToFuncBody(df *dst.File, funcName string, stmt dst.Stmt, pos int) (modified bool)
- func AddStmtToFuncBodyAfter(df *dst.File, funcName string, stmt, refStmt dst.Stmt) (modified bool)
- func AddStmtToFuncBodyBefore(df *dst.File, funcName string, stmt, refStmt dst.Stmt) (modified bool)
- func AddStmtToFuncBodyEnd(df *dst.File, funcName string, stmt dst.Stmt) (modified bool)
- func AddStmtToFuncBodyEndWithRecv(df *dst.File, recvName, funcName string, stmt dst.Stmt) (modified bool)
- func AddStmtToFuncBodyStart(df *dst.File, funcName string, stmt dst.Stmt) (modified bool)
- func AddStmtToFuncBodyStartWithRecv(df *dst.File, recvName, funcName string, stmt dst.Stmt) (modified bool)
- func AddStmtToFuncBodyWithRecv(df *dst.File, recvName string, funcName string, stmt dst.Stmt, pos int) (modified bool)
- func AddStmtToFuncLitBody(df *dst.File, scope Scope, stmt dst.Stmt, pos int) (modified bool)
- func AddVarIntoBlockGenDecl(df *dst.File, varIndex int64, spec *dst.ValueSpec) (ret bool)
- func DeleteAllStmtFromFuncBody(df *dst.File, funcName string) (modified bool)
- func DeleteAllStmtFromFuncBodyWithRecv(df *dst.File, recvName, funcName string) (modified bool)
- func DeleteArgFromCallExpr(df *dst.File, scope Scope, funcName string, arg dst.Expr) (modified bool)
- func DeleteArgToCallExpr(df *dst.File, scope Scope, funcName string, pos int) (modified bool)
- func DeleteFieldFromFuncDeclParams(df *dst.File, funcName string, field *dst.Field) (modified bool)
- func DeleteFuncFromFile(df *dst.File, funcName string) (modified bool)
- func DeleteSelectorExprFromFuncBody(df *dst.File, funcName string, selectorExpr dst.Expr) (modified bool)
- func DeleteStmtFromFuncBody(df *dst.File, funcName string, stmt dst.Stmt) (modified bool)
- func FprintFile(out io.Writer, df *dst.File, resolver guess.RestorerResolver, alias []PkgAlias) error
- func GetAnnotLineInFuncDeclComment(df *dst.File, funcName, sign, annot string) (ret string)
- func GetFuncDeclListWithPrefixSuffixInFile(df *dst.File, prefix, suffix string) (ret []string)
- func HasArgInCallExpr(df *dst.File, scope Scope, funcName string, arg dst.Expr) (ret bool)
- func HasFieldInFuncDeclParams(df *dst.File, funcName string, field *dst.Field) (ret bool)
- func HasFuncDeclInFile(df *dst.File, decl dst.FuncDecl) (ret bool)
- func HasFuncDeclWithRecvInFile(df *dst.File, decl dst.FuncDecl, recvName string) (ret bool)
- func HasSignInFuncComment(df *dst.File, funcName, sign string) (ret bool)
- func HasStmtInsideFuncBody(df *dst.File, funcName string, stmt dst.Stmt) (ret bool)
- func HasStmtInsideFuncBodyWithRecv(df *dst.File, recvName, funcName string, stmt dst.Stmt) (ret bool)
- func HasStructDeclInFile(df *dst.File, structName string) (ret bool)
- func HasVarInBlockGenDecl(df *dst.File, varIndex int64, spec *dst.ValueSpec) (ret bool)
- func ParseSrcFile(filename string, resolver guess.RestorerResolver) (df *dst.File, err error)
- func ParseSrcFileFromBytes(src []byte, resolver guess.RestorerResolver) (df *dst.File, err error)
- func PrintToBuf(df *dst.File, resolver guess.RestorerResolver, alias []PkgAlias) *bytes.Buffer
- func ReplaceFuncNameAndArgWithIndexInCallExpr(df *dst.File, scope Scope, funcName string, sign dst.Expr, newFuncName string, ...) (ret bool)
- func SetMethodOnReceiver(df *dst.File, scope Scope, receiver, oldMethod, newMethod string) (modified bool)
- func TrimAnnot(s string) string
- type PkgAlias
- type Scope
- type StructDecs
Constants ¶
This section is empty.
Variables ¶
var EmptyScope = Scope{}
Functions ¶
func AddArgToCallExpr ¶
func AddArgToCallExpr(df *dst.File, scope Scope, funcName string, arg dst.Expr, pos int) (modified bool)
AddArgToCallExpr adds given arg, to the function call's argument list, in the given position
func AddEmptyLineIntoFuncBody ¶ added in v1.1.6
AddEmptyLineIntoFuncBody add an empty line, inside the body of function,
func AddFieldToFuncDeclParams ¶
func AddFieldToFuncDeclParams(df *dst.File, funcName string, field *dst.Field, pos int) (modified bool)
AddFieldToFuncDeclParams adds given field, to the declaration params of the function, in the given position
func AddFieldToFuncLitParams ¶
AddFieldToFuncLitParams add statement to anonymous function params
func AddStmtToFuncBody ¶
AddStmtToFuncBody adds given statement, to the body of function, in the given position
func AddStmtToFuncBodyAfter ¶
AddStmtToFuncBodyAfter adds given statement, to the function body, after the position of refStmt, if refStmt not found, nothing will happen
func AddStmtToFuncBodyBefore ¶
AddStmtToFuncBodyBefore adds given statement, to the function body, before the position of refStmt. if refStmt not found, nothing will happen
func AddStmtToFuncBodyEnd ¶
AddStmtToFuncBodyEnd adds given statement, to the end of function body
func AddStmtToFuncBodyEndWithRecv ¶
func AddStmtToFuncBodyEndWithRecv(df *dst.File, recvName, funcName string, stmt dst.Stmt) (modified bool)
AddStmtToFuncBodyEndWithRecv adds given statement, to the end of function body
func AddStmtToFuncBodyStart ¶
AddStmtToFuncBodyStart adds given statement, to the start of function body
func AddStmtToFuncBodyStartWithRecv ¶
func AddStmtToFuncBodyStartWithRecv(df *dst.File, recvName, funcName string, stmt dst.Stmt) (modified bool)
AddStmtToFuncBodyStartWithRecv adds given statement, to the start of function body
func AddStmtToFuncBodyWithRecv ¶
func AddStmtToFuncBodyWithRecv(df *dst.File, recvName string, funcName string, stmt dst.Stmt, pos int) (modified bool)
AddStmtToFuncBodyWithRecv adds given statement, to the body of function, in the given position
func AddStmtToFuncLitBody ¶
AddStmtToFuncLitBody add statement to anonymous function body
func AddVarIntoBlockGenDecl ¶ added in v1.1.3
func DeleteAllStmtFromFuncBody ¶ added in v1.1.6
DeleteAllStmtFromFuncBody deletes any statement, inside the body of function, that is semantically equal to the given statement.
func DeleteAllStmtFromFuncBodyWithRecv ¶ added in v1.0.4
DeleteAllStmtFromFuncBodyWithRecv deletes any statement, inside the body of function, that is semantically equal to the given statement.
func DeleteArgFromCallExpr ¶
func DeleteArgFromCallExpr(df *dst.File, scope Scope, funcName string, arg dst.Expr) (modified bool)
DeleteArgFromCallExpr deletes any arg, in the function call's argument list, that is semantically equal to the given arg.
func DeleteArgToCallExpr ¶ added in v1.0.5
DeleteArgToCallExpr delete arg, to the function call's argument list, in the given position
func DeleteFieldFromFuncDeclParams ¶
DeleteFieldFromFuncDeclParams deletes any field, in the declaration params of the function, that is semantically equal to given field
func DeleteFuncFromFile ¶ added in v1.1.6
DeleteFuncFromFile deletes any func, inside the body of file, that is DeleteFuncFromFile.
func DeleteSelectorExprFromFuncBody ¶
func DeleteSelectorExprFromFuncBody(df *dst.File, funcName string, selectorExpr dst.Expr) (modified bool)
DeleteSelectorExprFromFuncBody deletes any SelectorExpr equal to the given one, inside the body of function.
func DeleteStmtFromFuncBody ¶
DeleteStmtFromFuncBody deletes any statement, inside the body of function, that is semantically equal to the given statement.
func FprintFile ¶
func FprintFile(out io.Writer, df *dst.File, resolver guess.RestorerResolver, alias []PkgAlias) error
FprintFile writes the *dst.File out to io.Writer
func GetFuncDeclListWithPrefixSuffixInFile ¶ added in v1.1.3
func HasArgInCallExpr ¶
HasArgInCallExpr checks if the arguments of the function call has given arg
func HasFieldInFuncDeclParams ¶
HasFieldInFuncDeclParams checks if the declaration params of the function, contains the given field
func HasSignInFuncComment ¶
func HasStmtInsideFuncBody ¶
HasStmtInsideFuncBody checks if the body of function has given statement
func HasStmtInsideFuncBodyWithRecv ¶
func HasStmtInsideFuncBodyWithRecv(df *dst.File, recvName, funcName string, stmt dst.Stmt) (ret bool)
HasStmtInsideFuncBodyWithRecv checks if the body of function has given statement
func HasVarInBlockGenDecl ¶ added in v1.1.3
func ParseSrcFile ¶
ParseSrcFile parses the given go src filename, in the form of valid path, into *dst.File
func ParseSrcFileFromBytes ¶
ParseSrcFileFromBytes parses the given go src file, in the form of bytes, into *dst.File
func PrintToBuf ¶
func ReplaceFuncNameAndArgWithIndexInCallExpr ¶ added in v1.1.3
func ReplaceFuncNameAndArgWithIndexInCallExpr(df *dst.File, scope Scope, funcName string, sign dst.Expr, newFuncName string, pos int, arg dst.Expr) (ret bool)
ReplaceFuncNameAndArgWithIndexInCallExpr replace arguments of the function call has given sign arg, then replace arg
func SetMethodOnReceiver ¶
Types ¶
type StructDecs ¶
type StructDecs struct { Name string Decs dst.Decorations }
func GetStructDecsInStructComment ¶
func GetStructDecsInStructComment(df *dst.File, sign string) (ret []StructDecs)