Commit 8fac7e3c authored by Russ Cox's avatar Russ Cox

cmd/go: document that go generate accepts all build flags

Fixes #12544.

Change-Id: I5e2fd1fbb21816e9f6fb022e2664484a71093b04
Reviewed-on: https://go-review.googlesource.com/17947Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent ab39b8de
...@@ -362,7 +362,7 @@ Generate Go files by processing source ...@@ -362,7 +362,7 @@ Generate Go files by processing source
Usage: Usage:
go generate [-run regexp] [file.go... | packages] go generate [-run regexp] [-n] [-v] [-x] [build flags] [file.go... | packages]
Generate runs commands described by directives within existing Generate runs commands described by directives within existing
files. Those commands can run any process but the intent is to files. Those commands can run any process but the intent is to
...@@ -460,6 +460,8 @@ processed. ...@@ -460,6 +460,8 @@ processed.
The -n flag prints commands that would be executed. The -n flag prints commands that would be executed.
The -x flag prints commands as they are executed. The -x flag prints commands as they are executed.
For more about build flags, see 'go help build'.
For more about specifying packages, see 'go help packages'. For more about specifying packages, see 'go help packages'.
...@@ -1316,6 +1318,14 @@ internally at Google all begin with 'google', and paths ...@@ -1316,6 +1318,14 @@ internally at Google all begin with 'google', and paths
denoting remote repositories begin with the path to the code, denoting remote repositories begin with the path to the code,
such as 'github.com/user/repo'. such as 'github.com/user/repo'.
Packages in a program need not have unique package names,
but there are two reserved package names with special meaning.
The name main indicates a command, not a library.
Commands are built into binaries and cannot be imported.
The name documentation indicates documentation for
a non-Go program in the directory. Files in package documentation
are ignored by the go command.
As a special case, if the package list is a list of .go files from a As a special case, if the package list is a list of .go files from a
single directory, the command is applied to a single synthesized single directory, the command is applied to a single synthesized
package made up of exactly those files, ignoring any build constraints package made up of exactly those files, ignoring any build constraints
......
...@@ -22,7 +22,7 @@ import ( ...@@ -22,7 +22,7 @@ import (
var cmdGenerate = &Command{ var cmdGenerate = &Command{
Run: runGenerate, Run: runGenerate,
UsageLine: "generate [-run regexp] [file.go... | packages]", UsageLine: "generate [-run regexp] [-n] [-v] [-x] [build flags] [file.go... | packages]",
Short: "generate Go files by processing source", Short: "generate Go files by processing source",
Long: ` Long: `
Generate runs commands described by directives within existing Generate runs commands described by directives within existing
...@@ -121,6 +121,8 @@ processed. ...@@ -121,6 +121,8 @@ processed.
The -n flag prints commands that would be executed. The -n flag prints commands that would be executed.
The -x flag prints commands as they are executed. The -x flag prints commands as they are executed.
For more about build flags, see 'go help build'.
For more about specifying packages, see 'go help packages'. For more about specifying packages, see 'go help packages'.
`, `,
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment