Documentation ¶
Overview ¶
Package ifacereader reads the specified interfaces, returning their listed methods.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoInterfaces = erk.New(ErkInvalidInput{}, "No interfaces provided for path '{{.path}}'. Please provide which interfaces to mock.") ErrDuplicatePath = erk.New(ErkInvalidInput{}, "Duplicate entry for path '{{.path}}'. Please combine both entries and list multiple interfaces instead.") ErrLoadingPackages = erk.New(ErkInvalidInput{}, "Unable to load all packages: {{.err}}") ErrReadingPackage = erk.New(ErkInvalidInput{}, "Error reading package '{{.path}}'") ErrInvalidInterface = erk.New(ErkInvalidInput{}, "Interface '{{.interface}}' not found in package: {{.package}}") ErrNotInterface = erk.New(ErkInvalidInput{}, "Type '{{.interface}}' is not an interface in package '{{.package}}', it's a '{{.type}}'") ErrPathMismatch = erk.New(ErkInternal{}, unexpectedErrorPrefix+": Could not find package details for path: {{.path}}") ErrLeftoverPackageDetails = erk.New(ErkInternal{}, unexpectedErrorPrefix+": Unexpected leftover package details") ErrFuncUnderlyingType = erk.New(ErkInternal{}, unexpectedErrorPrefix+": *types.Func underlying type was not *types.Signature, it was: {{type .underlyingType}}", ) )
Functions ¶
This section is empty.
Types ¶
type ErkInternal ¶
type ErkInternal struct{ erk.DefaultKind }
type ErkInvalidInput ¶
type ErkInvalidInput struct{ erk.DefaultKind }
type InterfaceReader ¶
type InterfaceReader struct{}
InterfaceReader reads the specified interfaces, returning their listed methods.
func (*InterfaceReader) ReadPackages ¶
func (r *InterfaceReader) ReadPackages(pkgDetails []*PackageDetails, pkgNameGen PackageNameGenerator) ([]*Package, error)
ReadPackages reads all the packages within the specified package and interface combinations.
type Package ¶
Package includes the details of parsing the interfaces in the package.
func (*Package) InterfaceNames ¶
InterfaceNames extracts each of the interface names for which to generate mocks.
type PackageDetails ¶
PackageDetails provides the package path and interfaces to the ReadPackages method.
type PackageNameGenerator ¶
type PackageNameGenerator interface {
GeneratePackageName(scopePackage *packages.Package, importedPackage *types.Package) string
}
PackageNameGenerator allows generating a package name for a type given the current package and the imported package.
type Readable ¶
type Readable interface {
ReadPackages(pkgDetails []*PackageDetails, pkgNameGen PackageNameGenerator) ([]*Package, error)
}
Readable reads the specified interfaces, returning their listed methods.