.\" 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.