1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
.\" This file was pre-generated by help2man 1.47.1.
.TH MOCKGEN "1" "September 2015" "" "User Commands"
.SH NAME
mockgen \- generate source for mock class of a Go source
.SH DESCRIPTION
The `mockgen` command is used to generate source code for a mock
class given a Go source file containing interfaces to be mocked.
mockgen has two modes of operation: source and reflect.
.PP
Source mode generates mock interfaces from a source file.
It is enabled by using the \fB\-source\fR flag. Other flags that
may be useful in this mode are \fB\-imports\fR and \fB\-aux_files\fR.
Example:
.IP
mockgen \fB\-source\fR=\fI\,foo\/\fR.go [other options]
.PP
Reflect mode generates mock interfaces by building a program
that uses reflection to understand interfaces. It is enabled
by passing two non\-flag arguments: an import path, and a
comma\-separated list of symbols.
Example:
.IP
mockgen database/sql/driver Conn,Driver
.HP
\fB\-aux_files=\fR"": (source mode) Comma\-separated pkg=path pairs of auxiliary Go source files.
.HP
\fB\-debug_parser\fR=\fI\,false\/\fR: Print out parser results only.
.HP
\fB\-destination=\fR"": Output file; defaults to stdout.
.HP
\fB\-exec_only=\fR"": (reflect mode) If set, execute this reflection program.
.HP
\fB\-imports=\fR"": (source mode) Comma\-separated name=path pairs of explicit imports to use.
.HP
\fB\-package=\fR"": Package of the generated code; defaults to the package of the input with a 'mock_' prefix.
.HP
\fB\-prog_only\fR=\fI\,false\/\fR: (reflect mode) Only generate the reflection program; write it to stdout.
.HP
\fB\-self_package=\fR"": If set, the package this mock will be part of.
.HP
\fB\-source=\fR"": (source mode) Input Go source file; enables source mode.
.PP
mockgen has two modes of operation: source and reflect.
.PP
Source mode generates mock interfaces from a source file.
It is enabled by using the \fB\-source\fR flag. Other flags that
may be useful in this mode are \fB\-imports\fR and \fB\-aux_files\fR.
Example:
.IP
mockgen \fB\-source\fR=\fI\,foo\/\fR.go [other options]
.PP
Reflect mode generates mock interfaces by building a program
that uses reflection to understand interfaces. It is enabled
by passing two non\-flag arguments: an import path, and a
comma\-separated list of symbols.
Example:
.IP
mockgen database/sql/driver Conn,Driver
.HP
\fB\-aux_files=\fR"": (source mode) Comma\-separated pkg=path pairs of auxiliary Go source files.
.HP
\fB\-debug_parser\fR=\fI\,false\/\fR: Print out parser results only.
.HP
\fB\-destination=\fR"": Output file; defaults to stdout.
.HP
\fB\-exec_only=\fR"": (reflect mode) If set, execute this reflection program.
.HP
\fB\-imports=\fR"": (source mode) Comma\-separated name=path pairs of explicit imports to use.
.HP
\fB\-package=\fR"": Package of the generated code; defaults to the package of the input with a 'mock_' prefix.
.HP
\fB\-prog_only\fR=\fI\,false\/\fR: (reflect mode) Only generate the reflection program; write it to stdout.
.HP
\fB\-self_package=\fR"": If set, the package this mock will be part of.
.HP
\fB\-source=\fR"": (source mode) Input Go source file; enables source mode.
|