Commit 08ba9c02 authored by Agniva De Sarker's avatar Agniva De Sarker Committed by Agniva De Sarker

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/+/149797Reviewed-by: default avatarDmitri Shuralyov <dmitshur@golang.org>
parent 724a86fc
...@@ -74,8 +74,8 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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'.
// //
......
...@@ -110,8 +110,8 @@ specifies that the command "foo" represents the generator ...@@ -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.
......
...@@ -22,7 +22,7 @@ var CmdRun = &base.Command{ ...@@ -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'.
......
...@@ -27,8 +27,8 @@ var CmdBuild = &base.Command{ ...@@ -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
......
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