Documentation
¶
Index ¶
- func GenPkg(srcPath, dstRoot, name string, mock bool, cfg *MockConfig) (importSet, error)
- func GetCmdOutput(cmd *exec.Cmd) (string, error)
- func GetImports(path string, tests bool) (importSet, error)
- func GetMockedPackages(path string) (map[string]string, error)
- func GetOutput(name string, args ...string) (string, error)
- func LinkPkg(srcPath, dstRoot, name string) (importSet, error)
- func LookupImportPath(impPath string) (string, error)
- func MakePkg(srcPath, dstPath, pkgName string, mock bool, cfg *MockConfig) (importSet, error)
- func MockImports(src, dst string, names map[string]string, cfg *Config) error
- func MockInterfaces(tmpPath, pkgName string, cfg *MockConfig) error
- func MockStandard(srcRoot, dstRoot, name string, cfg *MockConfig) error
- func NewRewriter(w io.Writer) *rewriter
- func ReplacePkg(srcPath, dstRoot, from, as string) (importSet, error)
- type Cache
- type Cerr
- type Config
- type Context
- func (c *Context) AddPackage(pkgName string) (string, error)
- func (c *Context) Chdir(pkg string) error
- func (c *Context) Close() error
- func (c *Context) DisableRewrite()
- func (c *Context) ExcludePackagesFromFile(path string) error
- func (c *Context) KeepWork()
- func (c *Context) LinkPackage(pkg string) error
- func (c *Context) LinkPackagesFromFile(path string) error
- func (c *Context) LoadConfig(path string) (err error)
- func (c *Context) Run(command string, args ...string) error
- type Interfaces
- type MockConfig
- type Package
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenPkg ¶
func GenPkg(srcPath, dstRoot, name string, mock bool, cfg *MockConfig) (importSet, error)
func GetImports ¶
func LookupImportPath ¶
func MakePkg ¶
func MakePkg(srcPath, dstPath, pkgName string, mock bool, cfg *MockConfig) (importSet, error)
MakePkg writes a mock version of the package found at srcPath into dstPath. If dstPath already exists, bad things will probably happen.
func MockInterfaces ¶
func MockInterfaces(tmpPath, pkgName string, cfg *MockConfig) error
func MockStandard ¶
func MockStandard(srcRoot, dstRoot, name string, cfg *MockConfig) error
func NewRewriter ¶
func ReplacePkg ¶
Types ¶
type Config ¶
type Config struct {
Mocks map[string]*MockConfig
}
func ReadConfig ¶
func (*Config) Mock ¶
func (c *Config) Mock(path string) *MockConfig
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func NewContext ¶
func (*Context) DisableRewrite ¶
func (c *Context) DisableRewrite()
func (*Context) ExcludePackagesFromFile ¶
func (*Context) LinkPackage ¶
func (*Context) LinkPackagesFromFile ¶
func (*Context) LoadConfig ¶
type Interfaces ¶
type Interfaces map[string]*ifInfo
type MockConfig ¶
type MockConfig struct {
// Local configuration
MockPrototypes bool // Mock prototypes (i.e. functions without bodies)
IgnoreInits bool // Don't call the original init functions
MatchOSArch bool // only use files for GOOS & GOARCH
IgnoreNonGoFiles bool // Don't copy non-go files into the mocked package
// File based configuration
MOCK string `yaml:"MOCK"`
EXPECT string `yaml:"EXPECT"`
ObjEXPECT string `yaml:"obj.EXPECT"`
}
type Package ¶
type Package interface {
Name() string
Label() string
Path() string
Loc() codeLoc
HasNonGoCode() (bool, error)
DisableInstall()
GetImports() (importSet, error)
MockImports(map[string]string, *Config) error
Link() (importSet, error)
Gen(mock bool, cfg *MockConfig) (importSet, error)
Install() error
}
func NewPackage ¶
Click to show internal directories.
Click to hide internal directories.