Documentation ¶
Index ¶
- func Check(code []byte) error
- func FullName(t Type) string
- func Import(fsys fs.FS, dir string) (*build.Package, error)
- func ImportPath(t Type) (path string, err error)
- func IsBuiltin(t Type) bool
- func IsImportType(t Type, importPath, name string) (bool, error)
- func TypeName(t Type) string
- type Alias
- type ArrayType
- func (t *ArrayType) Definition() (Declaration, error)
- func (t *ArrayType) ImportPath() (path string, err error)
- func (t *ArrayType) Inner() Type
- func (t *ArrayType) Name() string
- func (t *ArrayType) Qualify(qualifier string) Type
- func (t *ArrayType) String() string
- func (t *ArrayType) Unqualify() Type
- type ChanType
- type Declaration
- type EllipsisType
- type Field
- type Fielder
- type File
- func (f *File) Alias(name string) *Alias
- func (f *File) Aliases() (aliases []*Alias)
- func (f *File) Functions() (fns []*Function)
- func (f *File) Import() (path string, err error)
- func (f *File) ImportName(path string) (name string, err error)
- func (f *File) ImportPath(name string) (path string, err error)
- func (f *File) Imports() (map[string]string, error)
- func (f *File) Interface(name string) *Interface
- func (f *File) Interfaces() (ifaces []*Interface)
- func (f *File) Package() *Package
- func (f *File) Path() string
- func (f *File) Struct(name string) *Struct
- func (f *File) Structs() (stcts []*Struct)
- type FuncType
- type Function
- func (fn *Function) File() *File
- func (fn *Function) Name() string
- func (fn *Function) Package() *Package
- func (fn *Function) Params() (fields []*Param)
- func (fn *Function) Private() bool
- func (fn *Function) Receiver() *Receiver
- func (fn *Function) Results() (fields []*Result)
- func (fn *Function) Signature() string
- type IdentType
- type Interface
- func (iface *Interface) Directory() string
- func (iface *Interface) File() *File
- func (iface *Interface) Kind() Kind
- func (iface *Interface) Method(name string) *InterfaceMethod
- func (iface *Interface) Methods() (methods []*InterfaceMethod)
- func (iface *Interface) Name() string
- func (iface *Interface) Package() *Package
- type InterfaceMethod
- type InterfaceType
- type Kind
- type MapType
- type Package
- func (pkg *Package) Alias(name string) *Alias
- func (pkg *Package) Aliases() (aliases []*Alias)
- func (pkg *Package) Directory() string
- func (pkg *Package) FS() fs.FS
- func (pkg *Package) File(name string) *File
- func (pkg *Package) Files() []*File
- func (pkg *Package) Functions() (fns []*Function)
- func (pkg *Package) Import() (string, error)
- func (pkg *Package) Interface(name string) *Interface
- func (pkg *Package) Interfaces() (ifaces []*Interface)
- func (pkg *Package) Module() *gomod.Module
- func (pkg *Package) Name() string
- func (pkg *Package) Parser() *Parser
- func (pkg *Package) PublicFunctions() (fns []*Function)
- func (pkg *Package) PublicMethods() (fns []*Function)
- func (pkg *Package) ResolveImport(directory string) (string, error)
- func (pkg *Package) Struct(name string) *Struct
- func (pkg *Package) Structs() (stcts []*Struct)
- type Param
- type Parser
- type Receiver
- type Result
- func (f *Result) Definition() (Declaration, error)
- func (f *Result) File() *File
- func (f *Result) First() bool
- func (f *Result) IsError() bool
- func (f *Result) Last() bool
- func (f *Result) Name() string
- func (f *Result) Named() bool
- func (f *Result) Private() bool
- func (f *Result) String() string
- func (f *Result) Type() Type
- type SelectorType
- type SliceExpr
- type StarType
- type Struct
- func (stct *Struct) Directory() string
- func (stct *Struct) Field(name string) *Field
- func (stct *Struct) FieldAt(nth int) (field *Field, err error)
- func (stct *Struct) Fields() (fields []*Field)
- func (stct *Struct) File() *File
- func (stct *Struct) Kind() Kind
- func (stct *Struct) Method(name string) *Function
- func (stct *Struct) Methods() (methods []*Function)
- func (stct *Struct) Name() string
- func (stct *Struct) Package() *Package
- func (stct *Struct) Private() bool
- func (stct *Struct) PublicFields() (fields []*Field)
- func (stct *Struct) PublicMethods() (methods []*Function)
- type StructType
- type Tag
- type Tags
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Check ¶ added in v0.1.9
Check is a convenience function for tests to check Go code for syntax errors.
func ImportPath ¶
ImportPath tries going to the type's definition
func IsImportType ¶
IsImportType checks if the type matches the import type
Types ¶
type Alias ¶
type Alias struct {
// contains filtered or unexported fields
}
func (*Alias) Definition ¶
func (a *Alias) Definition() (Declaration, error)
Definition goes to the aliases definition
type ArrayType ¶
type ArrayType struct {
// contains filtered or unexported fields
}
ArrayType struct
func (*ArrayType) Definition ¶
func (t *ArrayType) Definition() (Declaration, error)
Definition returns the type definition
func (*ArrayType) ImportPath ¶
ImportPath returns the import path if there is one
type Declaration ¶
Declaration interface
func Definition ¶
func Definition(t Type) (Declaration, error)
Definition tries going to the type's definition
type EllipsisType ¶
type EllipsisType struct {
// contains filtered or unexported fields
}
Ellipsis struct
func (*EllipsisType) Definition ¶
func (t *EllipsisType) Definition() (Declaration, error)
Definition returns the declaration
func (*EllipsisType) ImportPath ¶
func (t *EllipsisType) ImportPath() (path string, err error)
ImportPath returns the import path if there is one
func (*EllipsisType) Name ¶
func (t *EllipsisType) Name() string
type Field ¶
type Field struct {
// contains filtered or unexported fields
}
Field is a regular struct field
func (*Field) Definition ¶
func (f *Field) Definition() (Declaration, error)
Definition gets the definition of the type
type File ¶
type File struct {
// contains filtered or unexported fields
}
File struct
func (*File) ImportName ¶
ImportName finds an import name by import path
func (*File) ImportPath ¶
ImportPath finds an import path by import name
func (*File) Interfaces ¶
Interfaces returns all the interfaces in a file
type Function ¶
type Function struct {
// contains filtered or unexported fields
}
Function struct
type IdentType ¶
type IdentType struct {
// contains filtered or unexported fields
}
IdentType struct
func (*IdentType) Definition ¶
func (t *IdentType) Definition() (Declaration, error)
Definition returns the type definition
func (*IdentType) ImportPath ¶
ImportPath returns the import path if there is one
type Interface ¶
type Interface struct {
// contains filtered or unexported fields
}
Interface struct
func (*Interface) Method ¶
func (iface *Interface) Method(name string) *InterfaceMethod
func (*Interface) Methods ¶
func (iface *Interface) Methods() (methods []*InterfaceMethod)
type InterfaceMethod ¶
type InterfaceMethod struct {
// contains filtered or unexported fields
}
func (*InterfaceMethod) File ¶
func (im *InterfaceMethod) File() *File
func (*InterfaceMethod) Name ¶
func (im *InterfaceMethod) Name() string
func (*InterfaceMethod) Params ¶
func (im *InterfaceMethod) Params() (fields []*Param)
func (*InterfaceMethod) Results ¶
func (im *InterfaceMethod) Results() (fields []*Result)
type InterfaceType ¶
type InterfaceType struct {
// contains filtered or unexported fields
}
InterfaceType struct
type Package ¶
type Package struct {
// contains filtered or unexported fields
}
Package struct
func (*Package) Interfaces ¶
Interfaces returns all the interfaces in the package
func (*Package) PublicFunctions ¶
PublicFunctions returns all public functions in the package
func (*Package) PublicMethods ¶
PublicMethods returns all public methods in the package
func (*Package) ResolveImport ¶
ResolveImport resolves a directory from an import path
type Param ¶
type Param struct {
// contains filtered or unexported fields
}
Param is a function input
func (*Param) Definition ¶
func (f *Param) Definition() (Declaration, error)
Definition gets the definition of the type
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser for parsing Go code.
type Receiver ¶
type Receiver struct {
// contains filtered or unexported fields
}
Receiver is a function input
func (*Receiver) Definition ¶
func (f *Receiver) Definition() (Declaration, error)
Definition gets the definition of the type
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result is a function output
func (*Result) Definition ¶
func (f *Result) Definition() (Declaration, error)
func (*Result) IsError ¶
IsError returns true if the field is an error TODO: eventually check if field implements error
type SelectorType ¶
type SelectorType struct {
// contains filtered or unexported fields
}
SelectorType struct
func (*SelectorType) Definition ¶
func (t *SelectorType) Definition() (Declaration, error)
Definition returns the type definition
func (*SelectorType) ImportPath ¶
func (t *SelectorType) ImportPath() (path string, err error)
ImportPath returns the import path if there is one
func (*SelectorType) Name ¶
func (t *SelectorType) Name() string
func (*SelectorType) String ¶
func (t *SelectorType) String() string
func (*SelectorType) Unqualify ¶
func (t *SelectorType) Unqualify() Type
Unqualify returns the selector type
type SliceExpr ¶
type SliceExpr struct {
// contains filtered or unexported fields
}
SliceExpr struct
type StarType ¶
type StarType struct {
// contains filtered or unexported fields
}
StarType struct
func (*StarType) Definition ¶
func (t *StarType) Definition() (Declaration, error)
Definition returns the type definition
func (*StarType) ImportPath ¶
ImportPath returns the import path if there is one
type Struct ¶
type Struct struct {
// contains filtered or unexported fields
}
Struct struct
func (*Struct) PublicFields ¶
PublicFields returns all public fields
func (*Struct) PublicMethods ¶
type StructType ¶
type StructType struct {
// contains filtered or unexported fields
}
StructType struct
type Type ¶
type Type interface { String() string // contains filtered or unexported methods }
Type fn
func Innermost ¶
Innermost returns the innermost type e.g. []*ast.Package becomes ast.Package e.g. []*string becomes string