Documentation ¶
Index ¶
Constants ¶
View Source
const (
Version = "v3"
)
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 }
func (*GeneratorVisitor) VisitWalk ¶
func (gv *GeneratorVisitor) VisitWalk(iface *Interface) error
type OutputStreamProvider ¶
type Parser2 ¶
type Parser2 struct {
// contains filtered or unexported fields
}
func NewParser2 ¶
func (*Parser2) FindInPackage ¶
func (*Parser2) 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.