Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit 58a501f

Browse files
jmhodgesdsymonds
authored andcommitted
Talk about mockgen's reflect mode in README.
Fixes #15. Signed-off-by: David Symonds <[email protected]>
1 parent 06883d9 commit 58a501f

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,29 @@ Alternatively, there is an online reference for the package hosted on GoPkgDoc
2727
Running mockgen
2828
---------------
2929

30+
`mockgen` has two modes of operation: source and reflect.
31+
Source mode generates mock interfaces from a source file.
32+
It is enabled by using the -source flag. Other flags that
33+
may be useful in this mode are -imports and -aux_files.
34+
35+
Example:
36+
37+
mockgen -source=foo.go [other options]
38+
39+
Reflect mode generates mock interfaces by building a program
40+
that uses reflection to understand interfaces. It is enabled
41+
by passing two non-flag arguments: an import path, and a
42+
comma-separated list of symbols.
43+
44+
Example:
45+
46+
mockgen database/sql/driver Conn,Driver
47+
3048
The `mockgen` command is used to generate source code for a mock
3149
class given a Go source file containing interfaces to be mocked.
3250
It supports the following flags:
3351

34-
* `-source`: The file containing interfaces to be mocked. You must
35-
supply this flag.
52+
* `-source`: A file containing interfaces to be mocked.
3653

3754
* `-destination`: A file to which to write the resulting source code. If you
3855
don't set this, the code is printed to standard output.

0 commit comments

Comments
 (0)