mockgen

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingMockConfig = erk.New(ErkInvalidConfig{}, "Missing `mocks` config in .ensure.yml file. For example:\n\n"+ensurefile.ExampleFile)
	ErrMissingPackages   = erk.New(ErkInvalidConfig{},
		"No mocks to generate. Please add some to `mocks.packages` in .ensure.yml file. For example:\n\n"+ensurefile.ExampleFile,
	)
	ErrDuplicatePackagePath = erk.New(ErkInvalidConfig{}, "Found duplicate package path: {{.packagePath}}. Package paths must be unique.")

	ErrMissingPackagePath       = erk.New(ErkInvalidConfig{}, "Missing `path` key for package.")
	ErrMissingPackageInterfaces = erk.New(ErkInvalidConfig{},
		"Package '{{.packagePath}}' has no interfaces to generate. Please add them using the `interfaces` key.",
	)

	ErrMultipleGenerationFailures = erk.New(ErkMultipleFailures{}, "Unable to generate at least one mock")
	ErrMockGenFailed              = erk.New(ErkMockGenError{}, "Could not run mockgen successfully for '{{.packageDescription}}': {{.err}}")

	ErrUnableToCreateDir  = erk.New(ErkFSWriteError{}, "Could not create directory '{{.path}}': {{.err}}")
	ErrUnableToCreateFile = erk.New(ErkFSWriteError{}, "Could not create file '{{.path}}': {{.err}}")
)
View Source
var (
	ErrTidyUnableToList    = erk.New(ErkUnableToTidy{}, "Could not list files recursively for '{{.path}}': {{.err}}")
	ErrTidyUnableToCleanup = erk.New(ErkUnableToTidy{}, "Could not delete '{{.path}}': {{.err}}")
)
View Source
var ErrInternalPackageOutsideModule = erk.New(ErkMockDestination{},
	"Cannot generate mock of internal package, since package '{{.packagePath}}' is not in the current module '{{.modulePath}}'",
)

Functions

This section is empty.

Types

type ErkFSWriteError

type ErkFSWriteError struct{ erk.DefaultKind }

type ErkInvalidConfig

type ErkInvalidConfig struct{ erk.DefaultKind }

type ErkMockDestination

type ErkMockDestination struct{ erk.DefaultKind }

type ErkMockGenError

type ErkMockGenError struct{ erk.DefaultKind }

type ErkMultipleFailures added in v0.1.1

type ErkMultipleFailures struct{ erk.DefaultKind }

type ErkUnableToTidy added in v0.1.4

type ErkUnableToTidy struct{ erk.DefaultKind }

type MockGen added in v0.1.4

type MockGen struct {
	CmdRun  runcmd.RunnerIface
	FSWrite fswrite.FSWriteIface
	Logger  *log.Logger
	Cleanup exitcleanup.ExitCleaner
}

func (*MockGen) GenerateMocks added in v0.1.4

func (g *MockGen) GenerateMocks(ctx context.Context, config *ensurefile.Config) error

GenerateMocks for the provided configuration.

func (*MockGen) TidyMocks added in v0.1.4

func (g *MockGen) TidyMocks(config *ensurefile.Config) error

TidyMocks removes any files other than those that are expected to exist in the mock directories.

type MockGenerator added in v0.1.4

type MockGenerator interface {
	GenerateMocks(ctx context.Context, config *ensurefile.Config) error
	TidyMocks(config *ensurefile.Config) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL