Documentation ¶
Overview ¶
Package goparse is the help package of Go language ast tree.
Index ¶
- Constants
- Variables
- func Format(fset *token.FileSet, node interface{}) string
- func ParseMulPackage(patterns []string, tags ...string) (pkgs []*packages.Package, err error)
- type Package
- func (p *Package) ConstDeclValue(f func(decl *ast.GenDecl, vspec *ast.ValueSpec, cm ast.CommentMap) bool)
- func (p *Package) ConstDeclValueWithType(t string, ...)
- func (p *Package) Fset() *token.FileSet
- func (p *Package) FuncDecl(f func(decl *ast.FuncDecl, cm ast.CommentMap) bool)
- func (p *Package) GenDecl(f func(decl *ast.GenDecl, cm ast.CommentMap) bool)
- func (p *Package) GetDefObj(name *ast.Ident) (obj types.Object, ok bool)
- func (p *Package) GetGenerateNode() (node ast.Node, cm ast.CommentMap, err error)
- func (p *Package) Package() *packages.Package
- func (p *Package) Position(pos token.Pos) token.Position
- func (p *Package) RangeFile(f func(file *ast.File, fset *token.FileSet, cm ast.CommentMap) bool)
- func (p *Package) TypeDecl(f func(decl *ast.GenDecl, typ *ast.TypeSpec, cm ast.CommentMap) bool)
- func (p *Package) TypeDeclWithName(typ string, f func(decl *ast.GenDecl, typ *ast.TypeSpec, cm ast.CommentMap))
- func (p *Package) VarDecl(f func(decl *ast.GenDecl, typ *ast.ValueSpec, cm ast.CommentMap) bool)
Constants ¶
View Source
const ( GOARCH = "GOARCH" GOOS = "GOOS" GOPATH = "GOPATH" GOPACKAGE = "GOPACKAGE" GOFILE = "GOFILE" GOLINE = "GOLINE" GoGeneratePrefix = "//go:generate" )
go generate tools environment value.
Variables ¶
View Source
var ( EnvGoArch string EnvGoOS string EnvGoPath string EnvGoPackage string EnvGoFile string EnvGoLine int )
go generate tools environment value.
View Source
var GoGenerateToolsCompatibilityLineCount int = 2
GoGenerateToolsCompatibilityLineCount use to modify compatibility line count
Functions ¶
Types ¶
type Package ¶
type Package struct {
// contains filtered or unexported fields
}
func ParseGeneratePackage ¶
ParseGeneratePackage by go generate env
func ParsePackage ¶
ParsePackage parse specified packages.
func (*Package) ConstDeclValue ¶
func (p *Package) ConstDeclValue(f func(decl *ast.GenDecl, vspec *ast.ValueSpec, cm ast.CommentMap) bool)
ConstDecl range const value
func (*Package) ConstDeclValueWithType ¶
func (p *Package) ConstDeclValueWithType(t string, f func(decl *ast.GenDecl, vspec *ast.ValueSpec, cm ast.CommentMap) bool)
ConstDeclValueWithType range specified type const values
func (*Package) GetGenerateNode ¶
GetGenerateNode get go generate tools specified node
func (*Package) TypeDeclWithName ¶
func (p *Package) TypeDeclWithName(typ string, f func(decl *ast.GenDecl, typ *ast.TypeSpec, cm ast.CommentMap))
TypeDeclWithName run with specified type define
Click to show internal directories.
Click to hide internal directories.