GO-TESTFLAG(7)            (2012-05-13)             GO-TESTFLAG(7)

          go - tool for managing Go source code

          The 'go test' command takes both flags that apply to 'go
          test' itself and flags that apply to the resulting test

          The test binary, called pkg.test, where pkg is the name of
          the directory containing the package sources, has its own

               Verbose output: log all tests as they are run.

          -test.run pattern
               Run only those tests and examples matching the regular

          -test.bench pattern
               Run benchmarks matching the regular expression.  By
               default, no benchmarks run.

          -test.cpuprofile cpu.out
               Write a CPU profile to the specified file before exit-

          -test.memprofile mem.out
               Write a memory profile to the specified file when all
               tests are complete.

          -test.memprofilerate n
               Enable more precise (and expensive) memory profiles by
               setting runtime.MemProfileRate.  See 'godoc runtime
               MemProfileRate'.  To profile all memory allocations,
               use -test.memprofilerate=1 and set the environment
               variable GOGC=off to disable the garbage collector,
               provided the test can run in the available memory with-
               out garbage collection.

          -test.parallel n
               Allow parallel execution of test functions that call
               t.Parallel.  The value of this flag is the maximum num-
               ber of tests to run simultaneously; by default, it is
               set to the value of GOMAXPROCS.

               Tell long-running tests to shorten their run time.  It
               is off by default but set during all.bash so that

     Page 1                       Plan 9             (printed 5/24/22)

     GO-TESTFLAG(7)            (2012-05-13)             GO-TESTFLAG(7)

               installing the Go tree can run a sanity check but not
               spend time running exhaustive tests.

          -test.timeout t
               If a test runs longer than t, panic.

          -test.benchtime n
               Run enough iterations of each benchmark to take n sec-
               onds.  The default is 1 second.

          -test.cpu 1,2,4
               Specify a list of GOMAXPROCS values for which the tests
               or benchmarks should be executed.  The default is the
               current value of GOMAXPROCS.

          For convenience, each of these -test.X flags of the test
          binary is also available as the flag -X in 'go test' itself.
          Flags not listed here are passed through unaltered.  For
          instance, the command

                go test -x -v -cpuprofile=prof.out -dir=testdata -update

          will compile the test binary and then run it as

                pkg.test -test.v -test.cpuprofile=prof.out -dir=testdata -update

          This manual page was written by Michael Stapelberg
          <stapelberg@debian.org>, for the Debian project (and may be
          used by others).

     Page 2                       Plan 9             (printed 5/24/22)