Documentation ¶
Index ¶
Constants ¶
View Source
const (
Version = "2.0.0"
)
Variables ¶
View Source
var ErrNotInterface = errors.New("expression not an interface")
ErrNotInterface is returned when the given type is not an interface type.
View Source
var ErrNotSetup = errors.New("not setup")
ErrNotSetup is returned when the generator is not configured.
View Source
var Gopath = os.Getenv("GOPATH")
Functions ¶
Types ¶
type FileOutputStreamProvider ¶
type FileOutputStreamProvider struct {
BaseDir string
}
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator is responsible for generating the string containing imports and the mock struct that will later be written out as file.
func NewGenerator ¶
NewGenerator builds a Generator.
func (*Generator) Generate ¶
Generate builds a string that constitutes a valid go source file containing the mock of the relevant interface.
func (*Generator) GeneratePrologue ¶
GeneratePrologue generates the prologue of the mock.
func (*Generator) GeneratePrologueComment ¶
GeneratePrologueComment adds a note after the prologue to the output string.
type GeneratorVisitor ¶
type GeneratorVisitor struct { Comment string OutputPackageName string OutputProvider OutputStreamProvider ImportPrefix string }
func (*GeneratorVisitor) VisitWalk ¶
func (gv *GeneratorVisitor) VisitWalk(iface *Interface) error
type NodeVisitor ¶
type NodeVisitor struct {
// contains filtered or unexported fields
}
func NewNodeVisitor ¶
func NewNodeVisitor() *NodeVisitor
func (*NodeVisitor) DeclaredInterfaces ¶
func (nv *NodeVisitor) DeclaredInterfaces() []string
type OutputStreamProvider ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
func (*Parser) FindInPackage ¶
func (*Parser) Interfaces ¶
type StdoutStreamProvider ¶
type StdoutStreamProvider struct { }
type Walker ¶
func (*Walker) Walk ¶
func (w *Walker) Walk(visitor WalkerVisitor) bool
Walk returns true if a mock is generated.
type WalkerVisitor ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.