]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: document testdata directory in "go help test"
authorJeff R. Allen <jra@nella.org>
Tue, 24 May 2016 17:46:11 +0000 (23:46 +0600)
committerIan Lance Taylor <iant@golang.org>
Tue, 24 May 2016 19:05:09 +0000 (19:05 +0000)
Document the correct use of the testdata directory
where test writers might be expecting to find it.

It seems that alldocs.go was out of date, so it
has picked up some other changes with this commit.

Fixes #14715.

Change-Id: I0a22676bb7a64b2a61b56495f7ea38db889d8b37
Reviewed-on: https://go-review.googlesource.com/23353
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/go/alldocs.go
src/cmd/go/test.go

index 2b74cb59e35c58fa53da34c17c1ab09c5f018c16..2a64657732067ccb2f706f84b148428828bec883 100644 (file)
@@ -570,6 +570,8 @@ syntax of package template.  The default output is equivalent to -f
         Stale         bool   // would 'go install' do anything for this package?
         StaleReason   string // explanation for Stale==true
         Root          string // Go root or Go path dir containing this package
+        ConflictDir   string // this directory shadows Dir in $GOPATH
+        BinaryOnly    bool   // binary-only package: cannot be recompiled from sources
 
         // Source files
         GoFiles        []string // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles)
@@ -704,6 +706,9 @@ Each listed package causes the execution of a separate test binary.
 Test files that declare a package with the suffix "_test" will be compiled as a
 separate package, and then linked and run with the main test binary.
 
+The go tool will ignore a directory named "testdata", making it available
+to hold ancillary data needed by the tests.
+
 By default, go test needs no arguments.  It compiles and tests the package
 with source in the current directory, including tests, and runs the tests.
 
@@ -882,7 +887,15 @@ the extension of the file name. These extensions are:
 Files of each of these types except .syso may contain build
 constraints, but the go command stops scanning for build constraints
 at the first item in the file that is not a blank line or //-style
-line comment.
+line comment. See the go/build package documentation for
+more details.
+
+Non-test Go source files can also include a //go:binary-only-package
+comment, indicating that the package sources are included
+for documentation only and must not be used to build the
+package binary. This enables distribution of Go packages in
+their compiled form alone. See the go/build package documentation
+for more details.
 
 
 GOPATH environment variable
@@ -1457,7 +1470,6 @@ control the execution of any test:
 
        -trace trace.out
            Write an execution trace to the specified file before exiting.
-           Writes test binary as -c would.
 
        -v
            Verbose output: log all tests as they are run. Also print all
index 02abcbe23a07f063fe761465728b5baa63655962..bc5982e61ce9cf7f5652b89381eafabe237dbfcd 100644 (file)
@@ -59,6 +59,9 @@ Each listed package causes the execution of a separate test binary.
 Test files that declare a package with the suffix "_test" will be compiled as a
 separate package, and then linked and run with the main test binary.
 
+The go tool will ignore a directory named "testdata", making it available
+to hold ancillary data needed by the tests.
+
 By default, go test needs no arguments.  It compiles and tests the package
 with source in the current directory, including tests, and runs the tests.