aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-09-26 13:50:39 -0400
committerRuss Cox <rsc@golang.org>2014-09-26 13:50:39 -0400
commit6d760fb082544531bd14be27b438a1d3a1ec0016 (patch)
tree052ba736d4a9758aecc84316e2ced9cd519e7892
parentce143f25e625ce40f4655185372dc93661545df0 (diff)
downloadgo-6d760fb082544531bd14be27b438a1d3a1ec0016.tar.xz
cmd/go: document that testdata directories are ignored
Also rebuild doc.go; was stale, so contains extra changes. Fixes #8677. LGTM=r R=golang-codereviews, r CC=golang-codereviews, iant https://golang.org/cl/148170043
-rw-r--r--src/cmd/go/doc.go29
-rw-r--r--src/cmd/go/help.go3
2 files changed, 21 insertions, 11 deletions
diff --git a/src/cmd/go/doc.go b/src/cmd/go/doc.go
index 0d4e263891..cffb53d995 100644
--- a/src/cmd/go/doc.go
+++ b/src/cmd/go/doc.go
@@ -524,16 +524,23 @@ non-test installation.
In addition to the build flags, the flags handled by 'go test' itself are:
- -c Compile the test binary to pkg.test but do not run it.
- (Where pkg is the last element of the package's import path.)
+ -c
+ Compile the test binary to pkg.test but do not run it
+ (where pkg is the last element of the package's import path).
+ The file name can be changed with the -o flag.
+
+ -exec xprog
+ Run the test binary using xprog. The behavior is the same as
+ in 'go run'. See 'go help run' for details.
-i
Install packages that are dependencies of the test.
Do not run the test.
- -exec xprog
- Run the test binary using xprog. The behavior is the same as
- in 'go run'. See 'go help run' for details.
+ -o file
+ Compile the test binary to the named file.
+ The test still runs (unless -c or -i is specified).
+
The test binary also accepts flags that control execution of the test; these
flags are also accessible by 'go test'. See 'go help testflag' for details.
@@ -910,7 +917,8 @@ single directory, the command is applied to a single synthesized
package made up of exactly those files, ignoring any build constraints
in those files and ignoring any other files in the directory.
-File names that begin with "." or "_" are ignored by the go tool.
+Directory and file names that begin with "." or "_" are ignored
+by the go tool, as are directories named "testdata".
Description of testing flags
@@ -942,6 +950,7 @@ control the execution of any test:
-blockprofile block.out
Write a goroutine blocking profile to the specified file
when all tests are complete.
+ Writes test binary as -c would.
-blockprofilerate n
Control the detail provided in goroutine blocking profiles by
@@ -973,8 +982,7 @@ control the execution of any test:
Sets -cover.
-coverprofile cover.out
- Write a coverage profile to the specified file after all tests
- have passed.
+ Write a coverage profile to the file after all tests have passed.
Sets -cover.
-cpu 1,2,4
@@ -984,10 +992,11 @@ control the execution of any test:
-cpuprofile cpu.out
Write a CPU profile to the specified file before exiting.
+ Writes test binary as -c would.
-memprofile mem.out
- Write a memory profile to the specified file after all tests
- have passed.
+ Write a memory profile to the file after all tests have passed.
+ Writes test binary as -c would.
-memprofilerate n
Enable more precise (and expensive) memory profiles by setting
diff --git a/src/cmd/go/help.go b/src/cmd/go/help.go
index d6651d179b..201f0e2d79 100644
--- a/src/cmd/go/help.go
+++ b/src/cmd/go/help.go
@@ -81,7 +81,8 @@ single directory, the command is applied to a single synthesized
package made up of exactly those files, ignoring any build constraints
in those files and ignoring any other files in the directory.
-File names that begin with "." or "_" are ignored by the go tool.
+Directory and file names that begin with "." or "_" are ignored
+by the go tool, as are directories named "testdata".
`,
}