types

package
v0.0.0-...-5b39b99 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2016 License: Unlicense Imports: 5 Imported by: 0

Documentation

Overview

Package types contains logic for parsing type definitions from ast packages and filtering those types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dir

type Dir struct {
	// contains filtered or unexported fields
}

A Dir is a type that represents a directory containing Go packages.

func (Dir) Dir

func (d Dir) Dir() string

Dir returns the directory path that d represents.

func (Dir) ExportedTypes

func (d Dir) ExportedTypes() []*ast.TypeSpec

ExportedTypes returns all *ast.TypeSpecs found by d. Interface types with anonymous interface types will be flattened, for ease of mocking by other logic.

func (Dir) Filter

func (d Dir) Filter(matchers ...*regexp.Regexp) Dir

Filter filters d's types, removing all types that don't match any of the passed in matchers.

func (Dir) Len

func (d Dir) Len() int

Len returns the number of types that will be returned by d.ExportedTypes().

func (Dir) Package

func (d Dir) Package() string

Package returns the name of d's importable package.

func (Dir) TestPackage

func (d Dir) TestPackage() string

TestPackage returns the name of d's test package. It may be the same as d.Package().

type Dirs

type Dirs []Dir

Dirs is a slice of Dir values, to provide sugar for running some methods against multiple Dir values.

func Load

func Load(goDirs ...GoDir) Dirs

Load loads a Dirs value for goDirs.

func (Dirs) Filter

func (d Dirs) Filter(patterns ...string) (dirs Dirs)

Filter calls Dir.Filter for each Dir in d.

type GoDir

type GoDir interface {
	Path() string
	Packages() map[string]*ast.Package
	Import(path, pkg string) (*ast.Package, error)
}

A GoDir is a type that represents a directory of Go files.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL