Commit Graph

22 Commits

Author SHA1 Message Date
Isaev Ivan
b052143b5a
Fix gosec vulnerabilities: file and directory permissions (#142)
- Fix G301: Poor file permissions used when creating a directory.
- Fix G306: Poor file permissions used when writing to a new file.

See https://github.com/securego/gosec#available-rules
2020-12-13 09:21:03 +05:30
Lucas Bremgartner
2ea33710f3
Print version with -version flag (#138)
Co-authored-by: Mat Ryer <matryer@users.noreply.github.com>
2020-09-18 09:16:40 +01:00
Umputun
be64288727
add skip-ensure flag to avoid import cycle (#140)
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
2020-09-17 09:49:08 +01:00
matryer
9581d77413 testing releasing 2020-09-02 10:30:40 +01:00
Suhas Karanth
005b899ec8
Add noop formatter as an option (#133)
Useful to print the generated source code for debugging.
2020-08-16 12:55:01 +05:30
Suhas Karanth
e3d1bd8a7e Update README for stub flag 2020-08-16 12:29:28 +05:30
Suhas Karanth
83ab8dd79f
Add -stub flag to stub func implementation (#132)
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>
2020-08-16 12:24:12 +05:30
Suhas Karanth
7721994d1b
Add fmt flag to specify formatter (#117)
- 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.
2020-03-10 18:38:14 +05:30
Suhas Karanth
fc1865052c Refactor flags, add run() for better extensibility (#115) 2019-12-23 15:10:26 +00:00
Suhas Karanth
1206bf1e2a
Allow aliasing interface name (#110)
Implementation based on #57.
2019-11-05 13:13:49 +05:30
Lucas Bremgartner
382bd174c0 Ensure target dir for mock exists (#112)
Fixes: #111
2019-11-03 15:12:56 +00:00
Lucas Bremgartner
b21592468b Add static interface implementation check
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.
2019-01-17 20:20:37 +01:00
Mat Ryer
ee06b7e813
Merge branch 'master' into patch-1 2018-03-07 09:07:17 +00:00
Stefan Warman
565e1649f5 Use x/tools/go/loader to load packages instead of custom importer. 2018-02-05 14:29:41 +01:00
Uwe Dauernheim
1b1675c967
Make generated mock file non-executable 2017-12-25 14:03:29 +01:00
Mat Ryer
df49857c18 added vendor example 2017-07-11 20:02:46 +01:00
Mat Ryer
4741efe1e6 minor tweaks 2016-10-14 10:57:57 +01:00
Mat Ryer
18033310b9 added go generate example 2016-09-21 22:02:49 +01:00
Mat Ryer
5d872a540b minor improvements 2016-09-21 21:55:13 +01:00
Mat Ryer
3dc5361304 fleshed out main tool 2016-09-21 21:49:12 +01:00
Mat Ryer
37723c8bd4 fixed #3 - correct type names 2016-09-21 21:39:26 +01:00
Mat Ryer
6a2af83edc early commit for moq command 2016-08-29 13:00:18 +01:00