Documentation ¶
Index ¶
Constants ¶
View Source
const ConfigTpl = `` /* 210-byte string literal not displayed */
ConfigTpl is a configuration file template.
View Source
const MockTpl = `` /* 1518-byte string literal not displayed */
MockTpl is a mock's template.
View Source
const (
// URL is the repository url.
URL = "https://github.com/suzuki-shunsuke/gomic"
)
View Source
const Version = "0.1.1"
Version is the gomic's version.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Default DefaultConfiguration Items []Item }
Config represents configuration.
type DefaultConfiguration ¶
type DefaultConfiguration struct {
SrcDefaultConfiguration
}
DefaultConfiguration represents default configuration.
type FileSystem ¶
type FileSystem interface { Exist(string) bool MkdirAll(string) error Write(string, []byte) error GetWriteCloser(string) (io.WriteCloser, error) Getwd() (string, error) }
FileSystem abstracts operations of the file system.
type ImportSpec ¶
ImportSpec represents an import statement.
type ImportSpecs ¶
type ImportSpecs interface { Add(ImportSpec) (ImportSpec, error) Names() map[string]ImportSpec Paths() map[string]ImportSpec }
ImportSpecs represents a collection of ImportSpec.
type Importer ¶
type Importer interface { GetFileByFilePath(filePath string, mode parser.Mode) (*ast.File, error) GetPkgsInDir(dirPath string, filter func(os.FileInfo) bool, mode parser.Mode) (map[string]*ast.Package, error) GetBuildPkgInDir(dir string, mode build.ImportMode) (*build.Package, error) GetBuildPkgByPkgPath(pkgPath, srcDir string, mode build.ImportMode) (*build.Package, error) }
Importer imports go's file and packages.
type Item ¶
type Item struct { Src Src Dest Dest DefaultConfiguration }
Item represents configuration of each mock.
type Method ¶
type Method interface { Name() string Declaration() string Definition() string ParamsStr() string ResultValuesStr() string HasResultNames() bool Imports() map[string]ImportSpec Results() []Var IsEllipsis() bool }
Method represents a mock's method.
type MockTemplateArg ¶
type MockTemplateArg interface { Version() string URL() string PackageName() string MockName() string Imports() [][]string Methods() []Method }
MockTemplateArg is a template argument and represents a mock.
type Src ¶
type Src struct { Package string Interface string Name string File string Dir string SrcDefaultConfiguration }
Src represents source configuration.
type SrcDefaultConfiguration ¶
type SrcDefaultConfiguration struct { InterfacePrefix string `yaml:"interface_prefix"` InterfaceSuffix string `yaml:"interface_suffix"` VendorDir string `yaml:"vendor_dir"` }
SrcDefaultConfiguration represents source's default configuration.
Click to show internal directories.
Click to hide internal directories.