]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: document that go generate accepts all build flags
authorRuss Cox <rsc@golang.org>
Thu, 17 Dec 2015 05:54:45 +0000 (00:54 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 17 Dec 2015 16:59:46 +0000 (16:59 +0000)
Fixes #12544.

Change-Id: I5e2fd1fbb21816e9f6fb022e2664484a71093b04
Reviewed-on: https://go-review.googlesource.com/17947
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/go/alldocs.go
src/cmd/go/generate.go

index 4487b7442e318b01e7ceb92d6973dc096426e986..6fe2b9e2b443bc57a88fdd5fe6d756c1985bf533 100644 (file)
@@ -362,7 +362,7 @@ Generate Go files by processing source
 
 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
 files. Those commands can run any process but the intent is to
@@ -460,6 +460,8 @@ processed.
 The -n flag prints commands that would be 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'.
 
 
@@ -1316,6 +1318,14 @@ internally at Google all begin with 'google', and paths
 denoting remote repositories begin with the path to the code,
 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
 single directory, the command is applied to a single synthesized
 package made up of exactly those files, ignoring any build constraints
index 0834aa78237e53c32e9b3030eefd1857da591d1a..cb54018bab52d7709b8a140d2aee5e38a2d61ced 100644 (file)
@@ -22,7 +22,7 @@ import (
 
 var cmdGenerate = &Command{
        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",
        Long: `
 Generate runs commands described by directives within existing
@@ -121,6 +121,8 @@ processed.
 The -n flag prints commands that would be 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'.
        `,
 }