1
0
mirror of https://github.com/golang/go synced 2024-11-24 02:40:17 -07:00

cmd/go/internal/{run,work,generate}: document file path location requirement

Mention that .go files must be from a single directory
for them to be treated as a single package.

Fixes #21529

Change-Id: I79cb08b9f43888814b1249a7b50bc7bc70bc1c72
Reviewed-on: https://go-review.googlesource.com/c/go/+/149797
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
Agniva De Sarker 2018-11-15 23:35:27 +05:30 committed by Agniva De Sarker
parent 724a86fced
commit 08ba9c0291
4 changed files with 10 additions and 10 deletions

View File

@ -74,8 +74,8 @@
// Build compiles the packages named by the import paths, // Build compiles the packages named by the import paths,
// along with their dependencies, but it does not install the results. // along with their dependencies, but it does not install the results.
// //
// If the arguments to build are a list of .go files, build treats // If the arguments to build are a list of .go files from a single directory,
// them as a list of source files specifying a single package. // build treats them as a list of source files specifying a single package.
// //
// When compiling a single main package, build writes // When compiling a single main package, build writes
// the resulting executable to an output file named after // the resulting executable to an output file named after
@ -505,8 +505,8 @@
// "go tool foo". // "go tool foo".
// //
// Generate processes packages in the order given on the command line, // Generate processes packages in the order given on the command line,
// one at a time. If the command line lists .go files, they are treated // one at a time. If the command line lists .go files from a single directory,
// as a single package. Within a package, generate processes the // they are treated as a single package. Within a package, generate processes the
// source files in a package in file name order, one at a time. Within // source files in a package in file name order, one at a time. Within
// a source file, generate runs generators in the order they appear // a source file, generate runs generators in the order they appear
// in the file, one at a time. // in the file, one at a time.
@ -1170,7 +1170,7 @@
// go run [build flags] [-exec xprog] package [arguments...] // go run [build flags] [-exec xprog] package [arguments...]
// //
// Run compiles and runs the named main Go package. // Run compiles and runs the named main Go package.
// Typically the package is specified as a list of .go source files, // Typically the package is specified as a list of .go source files from a single directory,
// but it may also be an import path, file system path, or pattern // but it may also be an import path, file system path, or pattern
// matching a single known package, as in 'go run .' or 'go run my/cmd'. // matching a single known package, as in 'go run .' or 'go run my/cmd'.
// //

View File

@ -110,8 +110,8 @@ specifies that the command "foo" represents the generator
"go tool foo". "go tool foo".
Generate processes packages in the order given on the command line, Generate processes packages in the order given on the command line,
one at a time. If the command line lists .go files, they are treated one at a time. If the command line lists .go files from a single directory,
as a single package. Within a package, generate processes the they are treated as a single package. Within a package, generate processes the
source files in a package in file name order, one at a time. Within source files in a package in file name order, one at a time. Within
a source file, generate runs generators in the order they appear a source file, generate runs generators in the order they appear
in the file, one at a time. in the file, one at a time.

View File

@ -22,7 +22,7 @@ var CmdRun = &base.Command{
Short: "compile and run Go program", Short: "compile and run Go program",
Long: ` Long: `
Run compiles and runs the named main Go package. Run compiles and runs the named main Go package.
Typically the package is specified as a list of .go source files, Typically the package is specified as a list of .go source files from a single directory,
but it may also be an import path, file system path, or pattern but it may also be an import path, file system path, or pattern
matching a single known package, as in 'go run .' or 'go run my/cmd'. matching a single known package, as in 'go run .' or 'go run my/cmd'.

View File

@ -27,8 +27,8 @@ var CmdBuild = &base.Command{
Build compiles the packages named by the import paths, Build compiles the packages named by the import paths,
along with their dependencies, but it does not install the results. along with their dependencies, but it does not install the results.
If the arguments to build are a list of .go files, build treats If the arguments to build are a list of .go files from a single directory,
them as a list of source files specifying a single package. build treats them as a list of source files specifying a single package.
When compiling a single main package, build writes When compiling a single main package, build writes
the resulting executable to an output file named after the resulting executable to an output file named after