Documentation ¶
Overview ¶
Package aster is golang coding efficiency engine.
Copyright 2018 henrylee2cn. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func IsExported(name string) bool
- func IsFuncNode(b Node) bool
- func IsTypeNode(b Node) bool
- type AliasType
- func (s AliasType) Implements(u TypeNode) bool
- func (s AliasType) IsAssign() bool
- func (s AliasType) Method(i int) (FuncNode, bool)
- func (s AliasType) MethodByName(name string) (FuncNode, bool)
- func (a *AliasType) Node() ast.Node
- func (s AliasType) NumMethod() int
- func (a *AliasType) String() string
- type BasicType
- func (s BasicType) Implements(u TypeNode) bool
- func (s BasicType) IsAssign() bool
- func (s BasicType) Method(i int) (FuncNode, bool)
- func (s BasicType) MethodByName(name string) (FuncNode, bool)
- func (b *BasicType) Node() ast.Node
- func (s BasicType) NumMethod() int
- func (b *BasicType) String() string
- type ChanType
- func (c *ChanType) Dir() ast.ChanDir
- func (s ChanType) Implements(u TypeNode) bool
- func (s ChanType) IsAssign() bool
- func (s ChanType) Method(i int) (FuncNode, bool)
- func (s ChanType) MethodByName(name string) (FuncNode, bool)
- func (c *ChanType) Node() ast.Node
- func (s ChanType) NumMethod() int
- func (c *ChanType) String() string
- type CommNodeMethods
- type File
- func (f *File) Fetch(fn func(Node) bool) (nodes []Node)
- func (f *File) Format() (string, error)
- func (f *File) FormatNode(node ast.Node) (string, error)
- func (f *File) Inspect(fn func(Node) bool)
- func (f *File) LookupImports(currPkgName string) (imports []*Import, found bool)
- func (f *File) LookupPackages(currPkgName string) (pkgs []*Package, found bool)
- func (f *File) LookupType(name string) (t TypeNode, found bool)
- func (f *File) LookupTypeInMod(name string) (t TypeNode, found bool)
- func (f *File) LookupTypeInPkg(name string) (t TypeNode, found bool)
- func (f *File) Package() (*Package, bool)
- func (f *File) Reparse() (err error)
- func (f *File) Store() (err error)
- func (f *File) String() string
- func (f *File) TryFormatNode(node ast.Node, defaultValue ...string) string
- type FuncDecl
- func (s FuncDecl) Doc() string
- func (s FuncDecl) Field(int) *StructField
- func (s FuncDecl) FieldByName(name string) (field *StructField, found bool)
- func (s FuncDecl) Filename() string
- func (s FuncDecl) Implements(u TypeNode) bool
- func (s FuncDecl) IsAssign() bool
- func (f *FuncDecl) IsVariadic() bool
- func (s FuncDecl) Kind() Kind
- func (s FuncDecl) Method(int) (FuncNode, bool)
- func (s FuncDecl) MethodByName(string) (FuncNode, bool)
- func (s FuncDecl) Name() string
- func (f *FuncDecl) Node() ast.Node
- func (s FuncDecl) NumField() int
- func (s FuncDecl) NumMethod() int
- func (f *FuncDecl) NumParam() int
- func (f *FuncDecl) NumResult() int
- func (f *FuncDecl) Param(i int) (ff *FuncField, found bool)
- func (s FuncDecl) PkgName() string
- func (f *FuncDecl) Recv() (*FuncField, bool)
- func (f *FuncDecl) Result(i int) (ff *FuncField, found bool)
- func (f *FuncDecl) String() string
- type FuncField
- type FuncNode
- type FuncNodeMethods
- type Import
- type InterfaceType
- func (s InterfaceType) Implements(u TypeNode) bool
- func (s InterfaceType) IsAssign() bool
- func (s InterfaceType) Method(i int) (FuncNode, bool)
- func (s InterfaceType) MethodByName(name string) (FuncNode, bool)
- func (i *InterfaceType) Node() ast.Node
- func (s InterfaceType) NumMethod() int
- func (i *InterfaceType) String() string
- type Kind
- type ListType
- func (s ListType) Implements(u TypeNode) bool
- func (s ListType) IsAssign() bool
- func (l *ListType) Len() (int, bool)
- func (s ListType) Method(i int) (FuncNode, bool)
- func (s ListType) MethodByName(name string) (FuncNode, bool)
- func (l *ListType) Node() ast.Node
- func (s ListType) NumMethod() int
- func (l *ListType) String() string
- type MapType
- type Module
- func (m *Module) Fetch(fn func(Node) bool) (nodes []Node)
- func (m *Module) Format() (codes map[string]map[string]string, first error)
- func (m *Module) FormatNode(node ast.Node) (string, error)
- func (m *Module) Inspect(fn func(Node) bool)
- func (m *Module) Reparse() (first error)
- func (m *Module) Store() (first error)
- type NilNode
- type Node
- type Package
- func (p *Package) Fetch(fn func(Node) bool) (nodes []Node)
- func (p *Package) Format() (codes map[string]string, first error)
- func (p *Package) FormatNode(node ast.Node) (string, error)
- func (p *Package) Inspect(fn func(Node) bool)
- func (p *Package) LookupType(name string) (t TypeNode, found bool)
- func (p *Package) Module() (*Module, bool)
- func (p *Package) Store() (first error)
- type StructField
- type StructTag
- func (s *StructTag) AddOptions(key string, options ...string)
- func (s *StructTag) Delete(keys ...string)
- func (s *StructTag) DeleteOptions(key string, options ...string)
- func (s *StructTag) Get(key string) (*Tag, error)
- func (s *StructTag) Keys() []string
- func (s *StructTag) Set(tag *Tag) error
- func (s *StructTag) String() string
- func (s *StructTag) Tags() []*Tag
- type StructType
- func (s *StructType) Field(i int) (field *StructField)
- func (s *StructType) FieldByName(name string) (field *StructField, found bool)
- func (s StructType) Implements(u TypeNode) bool
- func (s StructType) IsAssign() bool
- func (s StructType) Method(i int) (FuncNode, bool)
- func (s StructType) MethodByName(name string) (FuncNode, bool)
- func (s *StructType) Node() ast.Node
- func (s *StructType) NumField() int
- func (s StructType) NumMethod() int
- func (s *StructType) String() string
- type Tag
- type TypeNode
- type TypeNodeMethods
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsExported ¶
IsExported reports whether name is an exported Go symbol (that is, whether it begins with an upper-case letter).
Types ¶
type AliasType ¶
AliasType represents a alias type
func (AliasType) Implements ¶
Implements reports whether the type implements the interface type u.
func (AliasType) IsAssign ¶
func (s AliasType) IsAssign() bool
IsAssign is there `=` for declared type?
func (AliasType) Method ¶
Method returns the i'th method in the type's method set. It panics if i is not in the range [0, NumMethod()).
For a non-interface type T or *T, the returned Method's Type and Func fields describe a function whose first argument is the receiver.
For an interface type, the returned Method's Type field gives the method signature, without a receiver, and the Func field is nil.
func (AliasType) MethodByName ¶
MethodByName returns the method with that name in the type's method set and a boolean indicating if the method was found.
For a non-interface type T or *T, the returned Method's Type and Func fields describe a function whose first argument is the receiver.
For an interface type, the returned Method's Type field gives the method signature, without a receiver, and the Func field is nil.
type BasicType ¶
BasicType represents a basic type
func (BasicType) Implements ¶
Implements reports whether the type implements the interface type u.
func (BasicType) IsAssign ¶
func (s BasicType) IsAssign() bool
IsAssign is there `=` for declared type?
func (BasicType) Method ¶
Method returns the i'th method in the type's method set. It panics if i is not in the range [0, NumMethod()).
For a non-interface type T or *T, the returned Method's Type and Func fields describe a function whose first argument is the receiver.
For an interface type, the returned Method's Type field gives the method signature, without a receiver, and the Func field is nil.
func (BasicType) MethodByName ¶
MethodByName returns the method with that name in the type's method set and a boolean indicating if the method was found.
For a non-interface type T or *T, the returned Method's Type and Func fields describe a function whose first argument is the receiver.
For an interface type, the returned Method's Type field gives the method signature, without a receiver, and the Func field is nil.
type ChanType ¶
ChanType represents a channel type.
func (ChanType) Implements ¶
Implements reports whether the type implements the interface type u.
func (ChanType) IsAssign ¶
func (s ChanType) IsAssign() bool
IsAssign is there `=` for declared type?
func (ChanType) Method ¶
Method returns the i'th method in the type's method set. It panics if i is not in the range [0, NumMethod()).
For a non-interface type T or *T, the returned Method's Type and Func fields describe a function whose first argument is the receiver.
For an interface type, the returned Method's Type field gives the method signature, without a receiver, and the Func field is nil.
func (ChanType) MethodByName ¶
MethodByName returns the method with that name in the type's method set and a boolean indicating if the method was found.
For a non-interface type T or *T, the returned Method's Type and Func fields describe a function whose first argument is the receiver.
For an interface type, the returned Method's Type field gives the method signature, without a receiver, and the Func field is nil.
type CommNodeMethods ¶
type CommNodeMethods interface { // Node returns origin AST node. Node() ast.Node // Name returns the type's name within its package for a defined type. // For other (non-defined) types it returns the empty string. Name() string // Filename returns package name to which the node belongs PkgName() string // Filename returns filename to which the node belongs Filename() string // Kind returns the specific kind of this type. Kind() Kind // Doc returns lead comment. Doc() string // String returns the formated code block. String() string }
CommNodeMethods is the common methods of block interface.
type File ¶
type File struct { *ast.File PkgName string FileSet *token.FileSet Filename string Src []byte Imports []*Import Nodes map[token.Pos]Node // <type node pos, Node> // contains filtered or unexported fields }
A File node represents a Go source file.
The Comments list contains all comments in the source file in order of appearance, including the comments that are pointed to from other nodes via Doc and Comment fields.
For correct printing of source code containing comments (using packages go/format and go/printer), special care must be taken to update comments when a File's syntax tree is modified: For printing, comments are interspersed between tokens based on their position. If syntax tree nodes are removed or moved, relevant comments in their vicinity must also be removed (from the File.Comments list) or moved accordingly (by updating their positions). A CommentMap may be used to facilitate some of these operations.
Whether and how a comment is associated with a node depends on the interpretation of the syntax tree by the manipulating program: Except for Doc and Comment comments directly associated with nodes, the remaining comments are "free-floating" (see also issues #18593, #20744).
func ParseFile ¶
ParseFile parses the source code of a single Go source file and returns the corresponding ast.File node. The source code may be provided via the filename of the source file, or via the src parameter.
If src != nil, ParseFile parses the source from src and the filename is only used when recording position information. The type of the argument for the src parameter must be string, []byte, or io.Reader. If src == nil, ParseFile parses the file specified by filename.
The mode parameter controls the amount of source text parsed and other optional parser functionality. Position information is recorded in the file set fset, which must not be nil.
If the source couldn't be read, the returned AST is nil and the error indicates the specific failure. If the source was read but syntax errors were found, the result is a partial AST (with ast.Bad* nodes representing the fragments of erroneous source code). Multiple errors are returned via a scanner.ErrorList which is sorted by file position.
func (*File) FormatNode ¶
FormatNode formats the node and returns the string.
func (*File) LookupImports ¶
LookupImports lookups the import info by package name.
func (*File) LookupPackages ¶
LookupPackages lookups the package object by package name. NOTE: Only lookup the parsed module.
func (*File) LookupType ¶
LookupType lookups TypeNode by type name in current file.
func (*File) LookupTypeInMod ¶
LookupTypeInMod lookup Type by type name in current module.
func (*File) LookupTypeInPkg ¶
LookupTypeInPkg lookups TypeNode by type name in current package.
type FuncDecl ¶
type FuncDecl struct {
// contains filtered or unexported fields
}
FuncDecl function Declaration
func (FuncDecl) Field ¶
func (s FuncDecl) Field(int) *StructField
Field returns a struct type's i'th field.
func (FuncDecl) FieldByName ¶
func (s FuncDecl) FieldByName(name string) (field *StructField, found bool)
FieldByName returns the struct field with the given name and a boolean indicating if the field was found.
func (FuncDecl) Filename ¶
func (s FuncDecl) Filename() string
Filename returns filename to which the node belongs
func (FuncDecl) Implements ¶
Implements reports whether the type implements the interface type u.
func (FuncDecl) IsAssign ¶
func (s FuncDecl) IsAssign() bool
IsAssign is there `=` for declared type?
func (*FuncDecl) IsVariadic ¶
IsVariadic reports whether a function type's final input parameter is a "..." parameter. If so, t.In(t.NumIn() - 1) returns the parameter's implicit actual type []T.
For concreteness, if t represents func(x int, y ... float64), then
f.NumParam() == 2 f.Param(0) is the Type for "int" f.Param(1) is the Type for "[]float64" f.IsVariadic() == true
func (FuncDecl) Method ¶
Method returns the i'th method in the type's method set. For a non-interface type T or *T, the returned Method's Type and Func fields describe a function whose first argument is the receiver.
For an interface type, the returned Method's Type field gives the method signature, without a receiver, and the Func field is nil.
func (FuncDecl) MethodByName ¶
MethodByName returns the method with that name in the type's method set and a boolean indicating if the method was found.
For a non-interface type T or *T, the returned Method's Type and Func fields describe a function whose first argument is the receiver.
For an interface type, the returned Method's Type field gives the method signature, without a receiver, and the Func field is nil.
func (FuncDecl) Name ¶
func (s FuncDecl) Name() string
Name returns the type's name within its package for a defined type. For other (non-defined) types it returns the empty string.
func (FuncDecl) NumField ¶
func (s FuncDecl) NumField() int
NumField returns a struct type's field count.
func (FuncDecl) NumMethod ¶
func (s FuncDecl) NumMethod() int
NumMethod returns the number of exported methods in the type's method set.
func (FuncDecl) PkgName ¶
func (s FuncDecl) PkgName() string
Filename returns package name to which the node belongs
type FuncNode ¶
type FuncNode interface { CommNodeMethods FuncNodeMethods // contains filtered or unexported methods }
FuncNode is the representation of a Go function or method. NOTE: Kind = Func
type FuncNodeMethods ¶
type FuncNodeMethods interface { // NumParam returns a function type's input parameter count. NumParam() int // NumResult returns a function type's output parameter count. NumResult() int // Param returns the type of a function type's i'th input parameter. Param(int) (*FuncField, bool) // Result returns the type of a function type's i'th output parameter. Result(int) (*FuncField, bool) // IsVariadic reports whether a function type's final input parameter // is a "..." parameter. If so, t.In(t.NumIn() - 1) returns the parameter's // implicit actual type []T. // // For concreteness, if t represents func(x int, y ... float64), then // // f.NumParam() == 2 // f.Param(0) is the Type for "int" // f.Param(1) is the Type for "[]float64" // f.IsVariadic() == true // IsVariadic() bool // Recv returns receiver (methods); or returns false (functions) Recv() (*FuncField, bool) }
FuncNodeMethods is the representation of a Go function or method. NOTE: Kind = Func
type Import ¶
type Import struct { *ast.ImportSpec Name string Path string Doc *ast.CommentGroup }
Import import info
type InterfaceType ¶
type InterfaceType struct { *ast.InterfaceType // contains filtered or unexported fields }
InterfaceType represents a interface type.
func (InterfaceType) Implements ¶
Implements reports whether the type implements the interface type u.
func (InterfaceType) IsAssign ¶
func (s InterfaceType) IsAssign() bool
IsAssign is there `=` for declared type?
func (InterfaceType) Method ¶
Method returns the i'th method in the type's method set. It panics if i is not in the range [0, NumMethod()).
For a non-interface type T or *T, the returned Method's Type and Func fields describe a function whose first argument is the receiver.
For an interface type, the returned Method's Type field gives the method signature, without a receiver, and the Func field is nil.
func (InterfaceType) MethodByName ¶
MethodByName returns the method with that name in the type's method set and a boolean indicating if the method was found.
For a non-interface type T or *T, the returned Method's Type and Func fields describe a function whose first argument is the receiver.
For an interface type, the returned Method's Type field gives the method signature, without a receiver, and the Func field is nil.
func (InterfaceType) NumMethod ¶
func (s InterfaceType) NumMethod() int
NumMethod returns the number of exported methods in the type's method set.
func (*InterfaceType) String ¶
func (i *InterfaceType) String() string
String returns the formated code block.
type Kind ¶
type Kind uint
A Kind represents the specific kind of type that a Type represents. The zero Kind is not a valid kind.
type ListType ¶
ListType represents an array or slice type.
func (ListType) Implements ¶
Implements reports whether the type implements the interface type u.
func (ListType) IsAssign ¶
func (s ListType) IsAssign() bool
IsAssign is there `=` for declared type?
func (ListType) Method ¶
Method returns the i'th method in the type's method set. It panics if i is not in the range [0, NumMethod()).
For a non-interface type T or *T, the returned Method's Type and Func fields describe a function whose first argument is the receiver.
For an interface type, the returned Method's Type field gives the method signature, without a receiver, and the Func field is nil.
func (ListType) MethodByName ¶
MethodByName returns the method with that name in the type's method set and a boolean indicating if the method was found.
For a non-interface type T or *T, the returned Method's Type and Func fields describe a function whose first argument is the receiver.
For an interface type, the returned Method's Type field gives the method signature, without a receiver, and the Func field is nil.
type MapType ¶
MapType represents a map type.
func (MapType) Implements ¶
Implements reports whether the type implements the interface type u.
func (MapType) Method ¶
Method returns the i'th method in the type's method set. It panics if i is not in the range [0, NumMethod()).
For a non-interface type T or *T, the returned Method's Type and Func fields describe a function whose first argument is the receiver.
For an interface type, the returned Method's Type field gives the method signature, without a receiver, and the Func field is nil.
func (MapType) MethodByName ¶
MethodByName returns the method with that name in the type's method set and a boolean indicating if the method was found.
For a non-interface type T or *T, the returned Method's Type and Func fields describe a function whose first argument is the receiver.
For an interface type, the returned Method's Type field gives the method signature, without a receiver, and the Func field is nil.
type Module ¶
type Module struct { FileSet *token.FileSet Dir string Packages map[string]*Package // <package name, *Package> // contains filtered or unexported fields }
Module packages AST
func ParseDir ¶
func ParseDir(dir string, filter func(os.FileInfo) bool, mode ...parser.Mode) (module *Module, first error)
ParseDir calls ParseFile for all files with names ending in ".go" in the directory specified by path and returns a map of package name -> package AST with all the packages found.
If filter != nil, only the files with os.FileInfo entries passing through the filter (and ending in ".go") are considered. The mode bits are passed to ParseFile unchanged. Position information is recorded in fset, which must not be nil.
If the directory couldn't be read, a nil map and the respective error are returned. If a parse error occurred, a non-nil but incomplete map and the first error encountered are returned.
func (*Module) Fetch ¶
Fetch traversing through the current module, fetches node if fn returns true.
func (*Module) Format ¶
Format format the package and returns the string. @codes <packageName,<fileName,code>>
func (*Module) FormatNode ¶
FormatNode formats the node and returns the string.
type Node ¶
type Node interface { CommNodeMethods FuncNodeMethods TypeNodeMethods // contains filtered or unexported methods }
Node the basic sub-interface based on ast.Node extension, is the supertype of other extended interfaces.
type Package ¶
type Package struct { FileSet *token.FileSet Dir string Name string // package name Scope *ast.Scope // package scope across all files Imports map[string]*ast.Object // map of package id -> package object Files map[string]*File // Go source files by filename // contains filtered or unexported fields }
A Package node represents a set of source files collectively building a Go package.
func (*Package) Fetch ¶
Fetch traversing through the current package, fetches node if fn returns true.
func (*Package) FormatNode ¶
FormatNode formats the node and returns the string.
func (*Package) LookupType ¶
LookupType lookups TypeNode by type name in current package.
type StructField ¶
A StructField describes a single field in a struct.
func (*StructField) Anonymous ¶
func (s *StructField) Anonymous() bool
Anonymous returns whether the field is an anonymous field.
type StructTag ¶
type StructTag struct {
// contains filtered or unexported fields
}
A StructTag is the tag string in a struct field.
By convention, tag strings are a concatenation of optionally space-separated key:"value" pairs. Each key is a non-empty string consisting of non-control characters other than space (U+0020 ' '), quote (U+0022 '"'), and colon (U+003A ':'). Each value is quoted using U+0022 '"' characters and Go string literal syntax.
func (*StructTag) AddOptions ¶
AddOptions adds the given option for the given key. If the option already exists it doesn't add it again.
func (*StructTag) DeleteOptions ¶
DeleteOptions deletes the given options for the given key
func (*StructTag) Get ¶
Get returns the tag associated with the given key. If the key is present in the tag the value (which may be empty) is returned. Otherwise the returned value will be the empty string. The ok return value reports whether the tag exists or not (which the return value is nil).
func (*StructTag) Keys ¶
Keys returns a slice of tag keys. The order is the original tag order unless it was changed.
type StructType ¶
type StructType struct { *ast.StructType // contains filtered or unexported fields }
StructType represents a struct type.
func (*StructType) Field ¶
func (s *StructType) Field(i int) (field *StructField)
Field returns a struct type's i'th field. It panics if the type's Kind is not Struct. It panics if i is not in the range [0, NumField()).
func (*StructType) FieldByName ¶
func (s *StructType) FieldByName(name string) (field *StructField, found bool)
FieldByName returns the struct field with the given name and a boolean indicating if the field was found.
func (StructType) Implements ¶
Implements reports whether the type implements the interface type u.
func (StructType) IsAssign ¶
func (s StructType) IsAssign() bool
IsAssign is there `=` for declared type?
func (StructType) Method ¶
Method returns the i'th method in the type's method set. It panics if i is not in the range [0, NumMethod()).
For a non-interface type T or *T, the returned Method's Type and Func fields describe a function whose first argument is the receiver.
For an interface type, the returned Method's Type field gives the method signature, without a receiver, and the Func field is nil.
func (StructType) MethodByName ¶
MethodByName returns the method with that name in the type's method set and a boolean indicating if the method was found.
For a non-interface type T or *T, the returned Method's Type and Func fields describe a function whose first argument is the receiver.
For an interface type, the returned Method's Type field gives the method signature, without a receiver, and the Func field is nil.
func (*StructType) NumField ¶
func (s *StructType) NumField() int
NumField returns a struct type's field count.
func (StructType) NumMethod ¶
func (s StructType) NumMethod() int
NumMethod returns the number of exported methods in the type's method set.
func (*StructType) String ¶
func (s *StructType) String() string
String returns the formated code block.
type Tag ¶
Tag defines a single struct's string literal tag
type Tag struct { Key is the tag key, such as json, xml, etc.. i.e: `json:"foo,omitempty". Here key is: "json" Key string
Name is a part of the value i.e: `json:"foo,omitempty". Here name is: "foo" Name string
Options is a part of the value. It contains a slice of tag options i.e: `json:"foo,omitempty". Here options is: ["omitempty"] Options []string }
type TypeNode ¶
type TypeNode interface { CommNodeMethods TypeNodeMethods // contains filtered or unexported methods }
TypeNode is the representation of a Go type node. NOTE: Kind != Func
type TypeNodeMethods ¶
type TypeNodeMethods interface { // IsAssign is there `=` for declared type? IsAssign() bool // NumMethod returns the number of exported methods in the type's method set. NumMethod() int // Method returns the i'th method in the type's method set. // For a non-interface type T or *T, the returned Method's Type and Func // fields describe a function whose first argument is the receiver. // // For an interface type, the returned Method's Type field gives the // method signature, without a receiver, and the Func field is nil. Method(int) (FuncNode, bool) // MethodByName returns the method with that name in the type's // method set and a boolean indicating if the method was found. // // For a non-interface type T or *T, the returned Method's Type and Func // fields describe a function whose first argument is the receiver. // // For an interface type, the returned Method's Type field gives the // method signature, without a receiver, and the Func field is nil. MethodByName(string) (FuncNode, bool) // Implements reports whether the type implements the interface type u. Implements(u TypeNode) bool // NumField returns a struct type's field count. // It panics if the type's Kind is not Struct. NumField() int // Field returns a struct type's i'th field. // It panics if the type's Kind is not Struct. // It panics if i is not in the range [0, NumField()). Field(int) *StructField // FieldByName returns the struct field with the given name // and a boolean indicating if the field was found. // It panics if the type's Kind is not Struct. FieldByName(name string) (field *StructField, found bool) // contains filtered or unexported methods }
TypeNodeMethods is the representation of a Go type node. NOTE: Kind != Func