Documentation ¶
Index ¶
- Variables
- func AstWalk(filename string)
- func DisplayDecl(title string, decl []Declaration, value string, pDesc ...bool)
- func GoFormatBytes(inBytes []byte) (outByte []byte, err error)
- func GoFormatFile(filename string) (err error)
- type Declaration
- type GoDeclarations
- type GoSourceFileStructure
- func (gsfs *GoSourceFileStructure) GetFuncByName(dName string) (decl *Declaration)
- func (gsfs *GoSourceFileStructure) GetFuncPos(fName string) (lStart, lEnd int)
- func (gsfs *GoSourceFileStructure) GetStructByName(dName string) (decl *Declaration)
- func (gsfs *GoSourceFileStructure) GetVarByName(dName string, kind ...string) (decl *Declaration)
- func (gsfs *GoSourceFileStructure) GoSourceFileStructureSetup(filename string, zero ...bool) (err error)
Constants ¶
This section is empty.
Variables ¶
var OS = glfsfo.PermsStructNew()
Functions ¶
func DisplayDecl ¶
func DisplayDecl(title string, decl []Declaration, value string, pDesc ...bool)
displayDecl: Simply display retrieved content for debug purpose
func GoFormatBytes ¶
GoFormatBytes: Format bytes like gofmt function.
func GoFormatFile ¶
GoFormatFile: Format file like gofmt function.
Types ¶
type Declaration ¶
type GoDeclarations ¶
type GoDeclarations struct { Filename string PackageName string DataPresent bool Functions []storeDecl FunctNoComment []storeDecl FullFunc []storeDecl Types []storeDecl TypesNoComment []storeDecl Imports []storeDecl FoundRows []storeDecl Var []storeDecl // contains filtered or unexported fields }
func (*GoDeclarations) GoSourceGetInfos ¶
func (d *GoDeclarations) GoSourceGetInfos(filename string, funcName ...string) (err error)
getPackageName: retrieve package name of Go source file
func (*GoDeclarations) GoSourceGetLines ¶
func (d *GoDeclarations) GoSourceGetLines(filename string, wholeWord bool, terms ...string) (exist bool, err error)
getPackageName: retrieve package name of Go source file
type GoSourceFileStructure ¶
type GoSourceFileStructure struct { Filename string WriteAstToFilename string // Leave blank, do not save the AST file. To do before initialisation if needed. Package string Imports []Declaration Func []Declaration CallExpr []Declaration Comments []Declaration Struct []Declaration Var []Declaration UnImplemented []Declaration Unknown []Declaration Eol string // End of line type of the input file AstOut *bytes.Buffer // AST representation of the input file // Used to get a new empty structure when the library is not directly in the "import" section // but declared as a new type in the source of the end user (that's how I use it in most cases). EmptyDeclStruct Declaration EmptySliceDeclStruct []Declaration // contains filtered or unexported fields }
func (*GoSourceFileStructure) GetFuncByName ¶
func (gsfs *GoSourceFileStructure) GetFuncByName(dName string) (decl *Declaration)
GetFuncDeclByName: get function declaration by name
func (*GoSourceFileStructure) GetFuncPos ¶
func (gsfs *GoSourceFileStructure) GetFuncPos(fName string) (lStart, lEnd int)
GetPosFunc: get line start and line end of the specified function
func (*GoSourceFileStructure) GetStructByName ¶
func (gsfs *GoSourceFileStructure) GetStructByName(dName string) (decl *Declaration)
GetFuncDeclByName: get structure declaration by name
func (*GoSourceFileStructure) GetVarByName ¶
func (gsfs *GoSourceFileStructure) GetVarByName(dName string, kind ...string) (decl *Declaration)
GetFuncDeclByName: get variable declaration by name "kind" means: "var" ,"const" ,":=" ,"="
func (*GoSourceFileStructure) GoSourceFileStructureSetup ¶
func (gsfs *GoSourceFileStructure) GoSourceFileStructureSetup(filename string, zero ...bool) (err error)
GoSourceFileStructureSetup: setup and retieve information for designed file. Notice: the lines numbers and offsets start at 0. Set "zero" at false to start at 1.