File is removed before mock generation, if it exists. This is useful
when the mock generation is likely to fail due to some reason, for
example, package load failure due to change in the interface being
mocked (the existing mock is no longer valid and cannot be compiled). In
such cases, the -rm flag can be used instead of manually removing the
file (which could have fixed the issue).
For mocks generated outside of the tested package with tests lives inside the same package as the tested code (i.e. pkg_test not used) --skip-ensure suppresses import of the source pkg
https://github.com/matryer/moq/issues/139
fix typo in readme
When a mock is generated with the flag enabled, it introduces the
following changes:
- Does not panic on calling the method without a mock implementation.
- Return zero values iff the implementation is not provided and the
method has return parameters.
Co-authored-by: Scott Leuthaeuser <scott_leuthaeuser@homedepot.com>
- Support formatting output with gofmt(default) or goimports via flag.
- Introduce moq.Config struct to configure moq.Mocker instance. This
breaks backward compatibility but facilitates it in the future if and
when any features are added.
- Use golden file tests for validating formatters. Use
github.com/pmezard/go-difflib to print the diff between expected and
actual.
Add an additional line of code per interface to the generated mock file,
which allows the go compiler to statically check if the mock implements
the mocked interface.