From d58347a385da1fd8b78cb5ccf8cf30d20789ac97 Mon Sep 17 00:00:00 2001 From: Damiano Petrungaro Date: Sat, 12 Aug 2023 01:38:54 +0200 Subject: [PATCH] doc: add write_generate_directive flag in README (#59) --- README.md | 2 ++ mockgen/mockgen.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 96cae39..db8ac2d 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,8 @@ It supports the following flags: - `-write_package_comment`: Writes package documentation comment (godoc) if true. (default true) +- `-write_generate_directive`: Add //go:generate directive to regenerate the mock. (default false) + - `-write_source_comment`: Writes original file (source mode) or interface names (reflect mode) comment if true. (default true) - `-typed`: Generate Type-safe 'Return', 'Do', 'DoAndReturn' function. (default false) diff --git a/mockgen/mockgen.go b/mockgen/mockgen.go index 55dbc7b..ce57b75 100644 --- a/mockgen/mockgen.go +++ b/mockgen/mockgen.go @@ -60,7 +60,7 @@ var ( selfPackage = flag.String("self_package", "", "The full package import path for the generated code. The purpose of this flag is to prevent import cycles in the generated code by trying to include its own package. This can happen if the mock's package is set to one of its inputs (usually the main one) and the output is stdio so mockgen cannot detect the final output package. Setting this flag will then tell mockgen which import to exclude.") writePkgComment = flag.Bool("write_package_comment", true, "Writes package documentation comment (godoc) if true.") writeSourceComment = flag.Bool("write_source_comment", true, "Writes original file (source mode) or interface names (reflect mode) comment if true.") - writeGenerateDirective = flag.Bool("write_generate_directive", false, "Put the //go:generate directive into the generated code") + writeGenerateDirective = flag.Bool("write_generate_directive", false, "Add //go:generate directive to regenerate the mock") copyrightFile = flag.String("copyright_file", "", "Copyright file used to add copyright header") typed = flag.Bool("typed", false, "Generate Type-safe 'Return', 'Do', 'DoAndReturn' function") imports = flag.String("imports", "", "(source mode) Comma-separated name=path pairs of explicit imports to use.")