go-generate
run code generation directives in Go source files
TLDR
SYNOPSIS
go generate [-run regexp] [-skip regexp] [-n] [-v] [-x] [packages]
DESCRIPTION
go generate scans Go source files for special directives of the form //go:generate command and executes the specified command. It automates code generation before compilation, commonly used for creating string methods, mock implementations, protocol buffers, and other generated code. Directives must start at the beginning of a line with no space between // and go:generate.
PARAMETERS
-run regexp
Run only directives matching regexp.-skip regexp
Skip directives matching regexp.-n
Print commands without executing.-v
Print package names as processed.-x
Print commands as executed.
INSTALL
CAVEATS
Environment variables $GOARCH, $GOOS, $GOFILE, $GOLINE, $GOPACKAGE, $GOROOT, $DOLLAR, and $PATH are set during execution. Generated files should include a comment matching **^// Code generated .* DO NOT EDIT\.$ before non-comment content. go generate is never run automatically by go build or go test**; it must be invoked explicitly.
