do not delete it when exiting.
-x
print the commands.
+ -race
+ enable data race detection.
+ Currently supported only on linux/amd64,
+ darwin/amd64 and windows/amd64.
+ -ccflags 'arg list'
+ arguments to pass on each 5c, 6c, or 8c compiler invocation
-compiler name
name of compiler to use, as in runtime.Compiler (gccgo or gc)
-gccgoflags 'arg list'
DIR(.exe) from go build
DIR.test(.exe) from go test -c
MAINFILE(.exe) from go build MAINFILE.go
+ *.so from SWIG
In the list, DIR represents the final path element of the
directory, and MAINFILE is the base name of any Go source
code.google.com/p/goauth2/oauth
code.google.com/p/sqlite
-The -f flag specifies an alternate format for the list,
-using the syntax of package template. The default output
-is equivalent to -f '{{.ImportPath}}'. The struct
-being passed to the template is:
+The -f flag specifies an alternate format for the list, using the
+syntax of package template. The default output is equivalent to -f
+'{{.ImportPath}}'. One extra template function is available, "join",
+which calls strings.Join. The struct being passed to the template is:
type Package struct {
Dir string // directory containing package sources
Run benchmarks matching the regular expression.
By default, no benchmarks run.
+ -test.benchmem
+ Print memory allocation statistics for benchmarks.
+
-test.cpuprofile cpu.out
Write a CPU profile to the specified file before exiting.
garbage collector, provided the test can run in the available
memory without garbage collection.
+ -test.blockprofile block.out
+ Write a goroutine blocking profile to the specified file
+ when all tests are complete.
+
+ -test.blockprofilerate n
+ Control the detail provided in goroutine blocking profiles by setting
+ runtime.BlockProfileRate to n. See 'godoc runtime BlockProfileRate'.
+ The profiler aims to sample, on average, one blocking event every
+ n nanoseconds the program spends blocked. By default,
+ if -test.blockprofile is set without this flag, all blocking events
+ are recorded, equivalent to -test.blockprofilerate=1.
+
-test.parallel n
Allow parallel execution of test functions that call t.Parallel.
The value of this flag is the maximum number of tests to run
func BenchmarkXXX(b *testing.B) { ... }
-An example function is similar to a test function but, instead of using *testing.T
-to report success or failure, prints output to os.Stdout and os.Stderr.
+An example function is similar to a test function but, instead of using
+*testing.T to report success or failure, prints output to os.Stdout.
That output is compared against the function's "Output:" comment, which
must be the last comment in the function body (see example below). An
example with no such comment, or with no text after "Output:" is compiled
var eg InternalExample
- stdout, stderr := os.Stdout, os.Stderr
+ stdout := os.Stdout
for _, eg = range examples {
matched, err := matchString(*match, eg.Name)
fmt.Printf("=== RUN: %s\n", eg.Name)
}
- // capture stdout and stderr
+ // capture stdout
r, w, err := os.Pipe()
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
- os.Stdout, os.Stderr = w, w
+ os.Stdout = w
outC := make(chan string)
go func() {
buf := new(bytes.Buffer)
_, err := io.Copy(buf, r)
if err != nil {
- fmt.Fprintf(stderr, "testing: copying pipe: %v\n", err)
+ fmt.Fprintf(os.Stderr, "testing: copying pipe: %v\n", err)
os.Exit(1)
}
outC <- buf.String()
eg.F()
dt := time.Now().Sub(t0)
- // close pipe, restore stdout/stderr, get output
+ // close pipe, restore stdout, get output
w.Close()
- os.Stdout, os.Stderr = stdout, stderr
+ os.Stdout = stdout
out := <-outC
// report any errors