Documentation ¶
Overview ¶
Package srcdom provides utilities to manipulate Go's AST (Abstract Structure Tree). Using srcdom, you can easily access/extract information of types, funcions and variables from AST.
Index ¶
Constants ¶
This section is empty.
Variables ¶
WarnLog is log destination for warning messages
Functions ¶
This section is empty.
Types ¶
type Package ¶
type Package struct { Name string Imports []*Import Values []*Value Funcs []*Func Types []*Type // contains filtered or unexported fields }
Package represents a go package.
func Read ¶
Read reads a file or directory as a Package. If you are going to read a directory, see also ReadDir.
func ReadDir ¶ added in v0.2.0
ReadDir reads a directory as a Package. It reads "test" package when `testPackage` is set. It will fail if the directory contains non-test multiple packages.
func (*Package) FuncNames ¶ added in v0.3.0
FuncNames returns sorted names of function in the package.
func (*Package) ValueNames ¶ added in v0.3.0
ValueName returns sorted names of value in the package.
type Type ¶
type Type struct { Name string Defined bool IsStruct bool IsInterface bool Embeds []string Fields []*Field Methods []*Func // contains filtered or unexported fields }
Type represents a function.
func (*Type) FieldsByTag ¶
FieldsByTag collects fields which match with query. The query's format is "{tagName}" or "{tagName}:{value}".