This repository was archived by the owner on Jun 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -27,12 +27,29 @@ Alternatively, there is an online reference for the package hosted on GoPkgDoc
27
27
Running mockgen
28
28
---------------
29
29
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
+
30
48
The ` mockgen ` command is used to generate source code for a mock
31
49
class given a Go source file containing interfaces to be mocked.
32
50
It supports the following flags:
33
51
34
- * ` -source ` : The file containing interfaces to be mocked. You must
35
- supply this flag.
52
+ * ` -source ` : A file containing interfaces to be mocked.
36
53
37
54
* ` -destination ` : A file to which to write the resulting source code. If you
38
55
don't set this, the code is printed to standard output.
You can’t perform that action at this time.
0 commit comments