Documentation ¶
Index ¶
Constants ¶
View Source
const (
SemVer = "1.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.
Functions ¶
This section is empty.
Types ¶
type FileOutputStreamProvider ¶
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) GeneratePrologueNote ¶
GeneratePrologueNote adds a note after the prologue to the output string.
type GeneratorVisitor ¶
type GeneratorVisitor struct { InPackage bool Note string Osp OutputStreamProvider // The name of the output package, if InPackage is false (defaults to "mocks") PackageName string }
func (*GeneratorVisitor) VisitWalk ¶
func (this *GeneratorVisitor) VisitWalk(iface *Interface) error
type NodeVisitor ¶
type NodeVisitor struct {
// contains filtered or unexported fields
}
func NewNodeVisitor ¶
func NewNodeVisitor() *NodeVisitor
func (*NodeVisitor) DeclaredInterfaces ¶
func (n *NodeVisitor) DeclaredInterfaces() []string
type OutputStreamProvider ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
func (*Parser) Interfaces ¶
type StdoutStreamProvider ¶
type StdoutStreamProvider struct { }
type Walker ¶
type Walker struct { BaseDir string Recursive bool Filter *regexp.Regexp LimitOne bool BuildTags []string }
func (*Walker) Walk ¶
func (this *Walker) Walk(visitor WalkerVisitor) (generated bool)
type WalkerVisitor ¶
Click to show internal directories.
Click to hide internal directories.