Documentation ¶
Overview ¶
Package types contains logic for parsing type definitions from ast packages and filtering those types.
Index ¶
- type Dependency
- type Dir
- func (d *Dir) Clone(ctx context.Context) *Dir
- func (d *Dir) Decls(ctx context.Context) []ast.Decl
- func (d *Dir) Dependencies(ctx context.Context, name string) []Dependency
- func (d *Dir) Dir(ctx context.Context) string
- func (d *Dir) Filter(ctx context.Context, matchers ...*regexp.Regexp) *Dir
- func (d *Dir) Len(ctx context.Context) int
- func (d *Dir) Package(ctx context.Context) string
- type Dirs
- type GoDir
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dependency ¶
type Dependency interface { Name() string TypeName() string PkgPath() string PkgName() string ImportAliased() bool Type() ast.Expr Params() []*ast.Field AvoidCollision(ctx context.Context) dep.Dependency FromPkg(ctx context.Context, name, path string) dep.Dependency }
Dependency is a type for tracking dependencies of local logic.
type Dir ¶
type Dir struct {
// contains filtered or unexported fields
}
A Dir is a type that represents a directory containing Go packages.
func (*Dir) Decls ¶
Decls returns all ast.Decl (declarations) found by d. Interface types with anonymous interface types will be flattened, for ease of mocking by other logic.
This includes unexported declaratiions.
func (*Dir) Dependencies ¶
func (d *Dir) Dependencies(ctx context.Context, name string) []Dependency
Dependencies returns all interface types that typ depends on for method parameters or results.
func (*Dir) Filter ¶
Filter returns a copy of d with all types filtered. All types in the returned Dir will match at least one of the passed in matchers.