github.com/xushiwei/go@v0.0.0-20130601165731-2b9d83f45bc9/src/cmd/go/doc.go (about)

     1  // Copyright 2011 The Go Authors.  All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // DO NOT EDIT THIS FILE. GENERATED BY mkdoc.sh.
     6  // Edit the documentation in other files and rerun mkdoc.sh to generate this one.
     7  
     8  /*
     9  Go is a tool for managing Go source code.
    10  
    11  Usage:
    12  
    13  	go command [arguments]
    14  
    15  The commands are:
    16  
    17      build       compile packages and dependencies
    18      clean       remove object files
    19      doc         run godoc on package sources
    20      env         print Go environment information
    21      fix         run go tool fix on packages
    22      fmt         run gofmt on package sources
    23      get         download and install packages and dependencies
    24      install     compile and install packages and dependencies
    25      list        list packages
    26      run         compile and run Go program
    27      test        test packages
    28      tool        run specified go tool
    29      version     print Go version
    30      vet         run go tool vet on packages
    31  
    32  Use "go help [command]" for more information about a command.
    33  
    34  Additional help topics:
    35  
    36      gopath      GOPATH environment variable
    37      packages    description of package lists
    38      remote      remote import path syntax
    39      testflag    description of testing flags
    40      testfunc    description of testing functions
    41  
    42  Use "go help [topic]" for more information about that topic.
    43  
    44  
    45  Compile packages and dependencies
    46  
    47  Usage:
    48  
    49  	go build [-o output] [build flags] [packages]
    50  
    51  Build compiles the packages named by the import paths,
    52  along with their dependencies, but it does not install the results.
    53  
    54  If the arguments are a list of .go files, build treats them as a list
    55  of source files specifying a single package.
    56  
    57  When the command line specifies a single main package,
    58  build writes the resulting executable to output.
    59  Otherwise build compiles the packages but discards the results,
    60  serving only as a check that the packages can be built.
    61  
    62  The -o flag specifies the output file name. If not specified, the
    63  output file name depends on the arguments and derives from the name
    64  of the package, such as p.a for package p, unless p is 'main'. If
    65  the package is main and file names are provided, the file name
    66  derives from the first file name mentioned, such as f1 for 'go build
    67  f1.go f2.go'; with no files provided ('go build'), the output file
    68  name is the base name of the containing directory.
    69  
    70  The build flags are shared by the build, install, run, and test commands:
    71  
    72  	-a
    73  		force rebuilding of packages that are already up-to-date.
    74  	-n
    75  		print the commands but do not run them.
    76  	-p n
    77  		the number of builds that can be run in parallel.
    78  		The default is the number of CPUs available.
    79  	-race
    80  		enable data race detection.
    81  		Supported only on linux/amd64, darwin/amd64 and windows/amd64.
    82  	-v
    83  		print the names of packages as they are compiled.
    84  	-work
    85  		print the name of the temporary work directory and
    86  		do not delete it when exiting.
    87  	-x
    88  		print the commands.
    89  
    90  	-ccflags 'arg list'
    91  		arguments to pass on each 5c, 6c, or 8c compiler invocation.
    92  	-compiler name
    93  		name of compiler to use, as in runtime.Compiler (gccgo or gc).
    94  	-gccgoflags 'arg list'
    95  		arguments to pass on each gccgo compiler/linker invocation.
    96  	-gcflags 'arg list'
    97  		arguments to pass on each 5g, 6g, or 8g compiler invocation.
    98  	-installsuffix suffix
    99  		a suffix to use in the name of the package installation directory,
   100  		in order to keep output separate from default builds.
   101  		If using the -race flag, the install suffix is automatically set to race
   102  		or, if set explicitly, has _race appended to it.
   103  	-ldflags 'flag list'
   104  		arguments to pass on each 5l, 6l, or 8l linker invocation.
   105  	-tags 'tag list'
   106  		a list of build tags to consider satisfied during the build.
   107  		See the documentation for the go/build package for
   108  		more information about build tags.
   109  
   110  The list flags accept a space-separated list of strings. To embed spaces
   111  in an element in the list, surround it with either single or double quotes.
   112  
   113  For more about specifying packages, see 'go help packages'.
   114  For more about where packages and binaries are installed,
   115  see 'go help gopath'.
   116  
   117  See also: go install, go get, go clean.
   118  
   119  
   120  Remove object files
   121  
   122  Usage:
   123  
   124  	go clean [-i] [-r] [-n] [-x] [packages]
   125  
   126  Clean removes object files from package source directories.
   127  The go command builds most objects in a temporary directory,
   128  so go clean is mainly concerned with object files left by other
   129  tools or by manual invocations of go build.
   130  
   131  Specifically, clean removes the following files from each of the
   132  source directories corresponding to the import paths:
   133  
   134  	_obj/            old object directory, left from Makefiles
   135  	_test/           old test directory, left from Makefiles
   136  	_testmain.go     old gotest file, left from Makefiles
   137  	test.out         old test log, left from Makefiles
   138  	build.out        old test log, left from Makefiles
   139  	*.[568ao]        object files, left from Makefiles
   140  
   141  	DIR(.exe)        from go build
   142  	DIR.test(.exe)   from go test -c
   143  	MAINFILE(.exe)   from go build MAINFILE.go
   144  	*.so             from SWIG
   145  
   146  In the list, DIR represents the final path element of the
   147  directory, and MAINFILE is the base name of any Go source
   148  file in the directory that is not included when building
   149  the package.
   150  
   151  The -i flag causes clean to remove the corresponding installed
   152  archive or binary (what 'go install' would create).
   153  
   154  The -n flag causes clean to print the remove commands it would execute,
   155  but not run them.
   156  
   157  The -r flag causes clean to be applied recursively to all the
   158  dependencies of the packages named by the import paths.
   159  
   160  The -x flag causes clean to print remove commands as it executes them.
   161  
   162  For more about specifying packages, see 'go help packages'.
   163  
   164  
   165  Run godoc on package sources
   166  
   167  Usage:
   168  
   169  	go doc [-n] [-x] [packages]
   170  
   171  Doc runs the godoc command on the packages named by the
   172  import paths.
   173  
   174  For more about godoc, see 'godoc godoc'.
   175  For more about specifying packages, see 'go help packages'.
   176  
   177  The -n flag prints commands that would be executed.
   178  The -x flag prints commands as they are executed.
   179  
   180  To run godoc with specific options, run godoc itself.
   181  
   182  See also: go fix, go fmt, go vet.
   183  
   184  
   185  Print Go environment information
   186  
   187  Usage:
   188  
   189  	go env [var ...]
   190  
   191  Env prints Go environment information.
   192  
   193  By default env prints information as a shell script
   194  (on Windows, a batch file).  If one or more variable
   195  names is given as arguments,  env prints the value of
   196  each named variable on its own line.
   197  
   198  
   199  Run go tool fix on packages
   200  
   201  Usage:
   202  
   203  	go fix [packages]
   204  
   205  Fix runs the Go fix command on the packages named by the import paths.
   206  
   207  For more about fix, see 'godoc fix'.
   208  For more about specifying packages, see 'go help packages'.
   209  
   210  To run fix with specific options, run 'go tool fix'.
   211  
   212  See also: go fmt, go vet.
   213  
   214  
   215  Run gofmt on package sources
   216  
   217  Usage:
   218  
   219  	go fmt [-n] [-x] [packages]
   220  
   221  Fmt runs the command 'gofmt -l -w' on the packages named
   222  by the import paths.  It prints the names of the files that are modified.
   223  
   224  For more about gofmt, see 'godoc gofmt'.
   225  For more about specifying packages, see 'go help packages'.
   226  
   227  The -n flag prints commands that would be executed.
   228  The -x flag prints commands as they are executed.
   229  
   230  To run gofmt with specific options, run gofmt itself.
   231  
   232  See also: go doc, go fix, go vet.
   233  
   234  
   235  Download and install packages and dependencies
   236  
   237  Usage:
   238  
   239  	go get [-d] [-fix] [-u] [build flags] [packages]
   240  
   241  Get downloads and installs the packages named by the import paths,
   242  along with their dependencies.
   243  
   244  The -d flag instructs get to stop after downloading the packages; that is,
   245  it instructs get not to install the packages.
   246  
   247  The -fix flag instructs get to run the fix tool on the downloaded packages
   248  before resolving dependencies or building the code.
   249  
   250  The -u flag instructs get to use the network to update the named packages
   251  and their dependencies.  By default, get uses the network to check out
   252  missing packages but does not use it to look for updates to existing packages.
   253  
   254  Get also accepts all the flags in the 'go build' and 'go install' commands,
   255  to control the installation. See 'go help build'.
   256  
   257  When checking out or updating a package, get looks for a branch or tag
   258  that matches the locally installed version of Go. The most important
   259  rule is that if the local installation is running version "go1", get
   260  searches for a branch or tag named "go1". If no such version exists it
   261  retrieves the most recent version of the package.
   262  
   263  For more about specifying packages, see 'go help packages'.
   264  
   265  For more about how 'go get' finds source code to
   266  download, see 'go help remote'.
   267  
   268  See also: go build, go install, go clean.
   269  
   270  
   271  Compile and install packages and dependencies
   272  
   273  Usage:
   274  
   275  	go install [build flags] [packages]
   276  
   277  Install compiles and installs the packages named by the import paths,
   278  along with their dependencies.
   279  
   280  For more about the build flags, see 'go help build'.
   281  For more about specifying packages, see 'go help packages'.
   282  
   283  See also: go build, go get, go clean.
   284  
   285  
   286  List packages
   287  
   288  Usage:
   289  
   290  	go list [-e] [-f format] [-json] [-tags 'tag list'] [packages]
   291  
   292  List lists the packages named by the import paths, one per line.
   293  
   294  The default output shows the package import path:
   295  
   296      code.google.com/p/google-api-go-client/books/v1
   297      code.google.com/p/goauth2/oauth
   298      code.google.com/p/sqlite
   299  
   300  The -f flag specifies an alternate format for the list, using the
   301  syntax of package template.  The default output is equivalent to -f
   302  '{{.ImportPath}}'.  One extra template function is available, "join",
   303  which calls strings.Join. The struct being passed to the template is:
   304  
   305      type Package struct {
   306          Dir        string // directory containing package sources
   307          ImportPath string // import path of package in dir
   308          Name       string // package name
   309          Doc        string // package documentation string
   310          Target     string // install path
   311          Goroot     bool   // is this package in the Go root?
   312          Standard   bool   // is this package part of the standard Go library?
   313          Stale      bool   // would 'go install' do anything for this package?
   314          Root       string // Go root or Go path dir containing this package
   315  
   316          // Source files
   317          GoFiles  []string       // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles)
   318          CgoFiles []string       // .go sources files that import "C"
   319          IgnoredGoFiles []string // .go sources ignored due to build constraints
   320          CFiles   []string       // .c source files
   321          HFiles   []string       // .h source files
   322          SFiles   []string       // .s source files
   323          SysoFiles []string      // .syso object files to add to archive
   324          SwigFiles []string      // .swig files
   325          SwigCXXFiles []string   // .swigcxx files
   326  
   327          // Cgo directives
   328          CgoCFLAGS    []string // cgo: flags for C compiler
   329          CgoLDFLAGS   []string // cgo: flags for linker
   330          CgoPkgConfig []string // cgo: pkg-config names
   331  
   332          // Dependency information
   333          Imports []string // import paths used by this package
   334          Deps    []string // all (recursively) imported dependencies
   335  
   336          // Error information
   337          Incomplete bool            // this package or a dependency has an error
   338          Error      *PackageError   // error loading package
   339          DepsErrors []*PackageError // errors loading dependencies
   340  
   341          TestGoFiles  []string // _test.go files in package
   342          TestImports  []string // imports from TestGoFiles
   343          XTestGoFiles []string // _test.go files outside package
   344          XTestImports []string // imports from XTestGoFiles
   345      }
   346  
   347  The -json flag causes the package data to be printed in JSON format
   348  instead of using the template format.
   349  
   350  The -e flag changes the handling of erroneous packages, those that
   351  cannot be found or are malformed.  By default, the list command
   352  prints an error to standard error for each erroneous package and
   353  omits the packages from consideration during the usual printing.
   354  With the -e flag, the list command never prints errors to standard
   355  error and instead processes the erroneous packages with the usual
   356  printing.  Erroneous packages will have a non-empty ImportPath and
   357  a non-nil Error field; other information may or may not be missing
   358  (zeroed).
   359  
   360  The -tags flag specifies a list of build tags, like in the 'go build'
   361  command.
   362  
   363  For more about specifying packages, see 'go help packages'.
   364  
   365  
   366  Compile and run Go program
   367  
   368  Usage:
   369  
   370  	go run [build flags] gofiles... [arguments...]
   371  
   372  Run compiles and runs the main package comprising the named Go source files.
   373  If no files are named, it compiles and runs all non-test Go source files.
   374  
   375  For more about build flags, see 'go help build'.
   376  
   377  See also: go build.
   378  
   379  
   380  Test packages
   381  
   382  Usage:
   383  
   384  	go test [-c] [-i] [build flags] [packages] [flags for test binary]
   385  
   386  'Go test' automates testing the packages named by the import paths.
   387  It prints a summary of the test results in the format:
   388  
   389  	ok   archive/tar   0.011s
   390  	FAIL archive/zip   0.022s
   391  	ok   compress/gzip 0.033s
   392  	...
   393  
   394  followed by detailed output for each failed package.
   395  
   396  'Go test' recompiles each package along with any files with names matching
   397  the file pattern "*_test.go".  These additional files can contain test functions,
   398  benchmark functions, and example functions.  See 'go help testfunc' for more.
   399  Each listed package causes the execution of a separate test binary.
   400  
   401  Test files that declare a package with the suffix "_test" will be compiled as a
   402  separate package, and then linked and run with the main test binary.
   403  
   404  By default, go test needs no arguments.  It compiles and tests the package
   405  with source in the current directory, including tests, and runs the tests.
   406  
   407  The package is built in a temporary directory so it does not interfere with the
   408  non-test installation.
   409  
   410  In addition to the build flags, the flags handled by 'go test' itself are:
   411  
   412  	-c  Compile the test binary to pkg.test but do not run it.
   413  	    (Where pkg is the last element of the package's import path.)
   414  
   415  	-i
   416  	    Install packages that are dependencies of the test.
   417  	    Do not run the test.
   418  
   419  The test binary also accepts flags that control execution of the test; these
   420  flags are also accessible by 'go test'.  See 'go help testflag' for details.
   421  
   422  For more about build flags, see 'go help build'.
   423  For more about specifying packages, see 'go help packages'.
   424  
   425  See also: go build, go vet.
   426  
   427  
   428  Run specified go tool
   429  
   430  Usage:
   431  
   432  	go tool [-n] command [args...]
   433  
   434  Tool runs the go tool command identified by the arguments.
   435  With no arguments it prints the list of known tools.
   436  
   437  The -n flag causes tool to print the command that would be
   438  executed but not execute it.
   439  
   440  For more about each tool command, see 'go tool command -h'.
   441  
   442  
   443  Print Go version
   444  
   445  Usage:
   446  
   447  	go version
   448  
   449  Version prints the Go version, as reported by runtime.Version.
   450  
   451  
   452  Run go tool vet on packages
   453  
   454  Usage:
   455  
   456  	go vet [-n] [-x] [packages]
   457  
   458  Vet runs the Go vet command on the packages named by the import paths.
   459  
   460  For more about vet, see 'godoc vet'.
   461  For more about specifying packages, see 'go help packages'.
   462  
   463  To run the vet tool with specific options, run 'go tool vet'.
   464  
   465  The -n flag prints commands that would be executed.
   466  The -x flag prints commands as they are executed.
   467  
   468  See also: go fmt, go fix.
   469  
   470  
   471  GOPATH environment variable
   472  
   473  The Go path is used to resolve import statements.
   474  It is implemented by and documented in the go/build package.
   475  
   476  The GOPATH environment variable lists places to look for Go code.
   477  On Unix, the value is a colon-separated string.
   478  On Windows, the value is a semicolon-separated string.
   479  On Plan 9, the value is a list.
   480  
   481  GOPATH must be set to get, build and install packages outside the
   482  standard Go tree.
   483  
   484  Each directory listed in GOPATH must have a prescribed structure:
   485  
   486  The src/ directory holds source code.  The path below 'src'
   487  determines the import path or executable name.
   488  
   489  The pkg/ directory holds installed package objects.
   490  As in the Go tree, each target operating system and
   491  architecture pair has its own subdirectory of pkg
   492  (pkg/GOOS_GOARCH).
   493  
   494  If DIR is a directory listed in the GOPATH, a package with
   495  source in DIR/src/foo/bar can be imported as "foo/bar" and
   496  has its compiled form installed to "DIR/pkg/GOOS_GOARCH/foo/bar.a".
   497  
   498  The bin/ directory holds compiled commands.
   499  Each command is named for its source directory, but only
   500  the final element, not the entire path.  That is, the
   501  command with source in DIR/src/foo/quux is installed into
   502  DIR/bin/quux, not DIR/bin/foo/quux.  The foo/ is stripped
   503  so that you can add DIR/bin to your PATH to get at the
   504  installed commands.  If the GOBIN environment variable is
   505  set, commands are installed to the directory it names instead
   506  of DIR/bin.
   507  
   508  Here's an example directory layout:
   509  
   510      GOPATH=/home/user/gocode
   511  
   512      /home/user/gocode/
   513          src/
   514              foo/
   515                  bar/               (go code in package bar)
   516                      x.go
   517                  quux/              (go code in package main)
   518                      y.go
   519          bin/
   520              quux                   (installed command)
   521          pkg/
   522              linux_amd64/
   523                  foo/
   524                      bar.a          (installed package object)
   525  
   526  Go searches each directory listed in GOPATH to find source code,
   527  but new packages are always downloaded into the first directory
   528  in the list.
   529  
   530  
   531  Description of package lists
   532  
   533  Many commands apply to a set of packages:
   534  
   535  	go action [packages]
   536  
   537  Usually, [packages] is a list of import paths.
   538  
   539  An import path that is a rooted path or that begins with
   540  a . or .. element is interpreted as a file system path and
   541  denotes the package in that directory.
   542  
   543  Otherwise, the import path P denotes the package found in
   544  the directory DIR/src/P for some DIR listed in the GOPATH
   545  environment variable (see 'go help gopath').
   546  
   547  If no import paths are given, the action applies to the
   548  package in the current directory.
   549  
   550  The special import path "all" expands to all package directories
   551  found in all the GOPATH trees.  For example, 'go list all'
   552  lists all the packages on the local system.
   553  
   554  The special import path "std" is like all but expands to just the
   555  packages in the standard Go library.
   556  
   557  An import path is a pattern if it includes one or more "..." wildcards,
   558  each of which can match any string, including the empty string and
   559  strings containing slashes.  Such a pattern expands to all package
   560  directories found in the GOPATH trees with names matching the
   561  patterns.  As a special case, x/... matches x as well as x's subdirectories.
   562  For example, net/... expands to net and packages in its subdirectories.
   563  
   564  An import path can also name a package to be downloaded from
   565  a remote repository.  Run 'go help remote' for details.
   566  
   567  Every package in a program must have a unique import path.
   568  By convention, this is arranged by starting each path with a
   569  unique prefix that belongs to you.  For example, paths used
   570  internally at Google all begin with 'google', and paths
   571  denoting remote repositories begin with the path to the code,
   572  such as 'code.google.com/p/project'.
   573  
   574  As a special case, if the package list is a list of .go files from a
   575  single directory, the command is applied to a single synthesized
   576  package made up of exactly those files, ignoring any build constraints
   577  in those files and ignoring any other files in the directory.
   578  
   579  
   580  Remote import path syntax
   581  
   582  An import path (see 'go help packages') denotes a package
   583  stored in the local file system.  Certain import paths also
   584  describe how to obtain the source code for the package using
   585  a revision control system.
   586  
   587  A few common code hosting sites have special syntax:
   588  
   589  	Bitbucket (Git, Mercurial)
   590  
   591  		import "bitbucket.org/user/project"
   592  		import "bitbucket.org/user/project/sub/directory"
   593  
   594  	GitHub (Git)
   595  
   596  		import "github.com/user/project"
   597  		import "github.com/user/project/sub/directory"
   598  
   599  	Google Code Project Hosting (Git, Mercurial, Subversion)
   600  
   601  		import "code.google.com/p/project"
   602  		import "code.google.com/p/project/sub/directory"
   603  
   604  		import "code.google.com/p/project.subrepository"
   605  		import "code.google.com/p/project.subrepository/sub/directory"
   606  
   607  	Launchpad (Bazaar)
   608  
   609  		import "launchpad.net/project"
   610  		import "launchpad.net/project/series"
   611  		import "launchpad.net/project/series/sub/directory"
   612  
   613  		import "launchpad.net/~user/project/branch"
   614  		import "launchpad.net/~user/project/branch/sub/directory"
   615  
   616  For code hosted on other servers, import paths may either be qualified
   617  with the version control type, or the go tool can dynamically fetch
   618  the import path over https/http and discover where the code resides
   619  from a <meta> tag in the HTML.
   620  
   621  To declare the code location, an import path of the form
   622  
   623  	repository.vcs/path
   624  
   625  specifies the given repository, with or without the .vcs suffix,
   626  using the named version control system, and then the path inside
   627  that repository.  The supported version control systems are:
   628  
   629  	Bazaar      .bzr
   630  	Git         .git
   631  	Mercurial   .hg
   632  	Subversion  .svn
   633  
   634  For example,
   635  
   636  	import "example.org/user/foo.hg"
   637  
   638  denotes the root directory of the Mercurial repository at
   639  example.org/user/foo or foo.hg, and
   640  
   641  	import "example.org/repo.git/foo/bar"
   642  
   643  denotes the foo/bar directory of the Git repository at
   644  example.com/repo or repo.git.
   645  
   646  When a version control system supports multiple protocols,
   647  each is tried in turn when downloading.  For example, a Git
   648  download tries git://, then https://, then http://.
   649  
   650  If the import path is not a known code hosting site and also lacks a
   651  version control qualifier, the go tool attempts to fetch the import
   652  over https/http and looks for a <meta> tag in the document's HTML
   653  <head>.
   654  
   655  The meta tag has the form:
   656  
   657  	<meta name="go-import" content="import-prefix vcs repo-root">
   658  
   659  The import-prefix is the import path corresponding to the repository
   660  root. It must be a prefix or an exact match of the package being
   661  fetched with "go get". If it's not an exact match, another http
   662  request is made at the prefix to verify the <meta> tags match.
   663  
   664  The vcs is one of "git", "hg", "svn", etc,
   665  
   666  The repo-root is the root of the version control system
   667  containing a scheme and not containing a .vcs qualifier.
   668  
   669  For example,
   670  
   671  	import "example.org/pkg/foo"
   672  
   673  will result in the following request(s):
   674  
   675  	https://example.org/pkg/foo?go-get=1 (preferred)
   676  	http://example.org/pkg/foo?go-get=1  (fallback)
   677  
   678  If that page contains the meta tag
   679  
   680  	<meta name="go-import" content="example.org git https://code.org/r/p/exproj">
   681  
   682  the go tool will verify that https://example.org/?go-get=1 contains the
   683  same meta tag and then git clone https://code.org/r/p/exproj into
   684  GOPATH/src/example.org.
   685  
   686  New downloaded packages are written to the first directory
   687  listed in the GOPATH environment variable (see 'go help gopath').
   688  
   689  The go command attempts to download the version of the
   690  package appropriate for the Go release being used.
   691  Run 'go help install' for more.
   692  
   693  
   694  Description of testing flags
   695  
   696  The 'go test' command takes both flags that apply to 'go test' itself
   697  and flags that apply to the resulting test binary.
   698  
   699  Several of the flags control profiling and write an execution profile
   700  suitable for "go tool pprof"; run "go tool pprof help" for more
   701  information.  The --alloc_space, --alloc_objects, and --show_bytes
   702  options of pprof control how the information is presented.
   703  
   704  The following flags are recognized by the 'go test' command and
   705  control the execution of any test:
   706  
   707  	-bench regexp
   708  	    Run benchmarks matching the regular expression.
   709  	    By default, no benchmarks run. To run all benchmarks,
   710  	    use '-bench .' or '-bench=.'.
   711  
   712  	-benchmem
   713  	    Print memory allocation statistics for benchmarks.
   714  
   715  	-benchtime t
   716  	    Run enough iterations of each benchmark to take t, specified
   717  	    as a time.Duration (for example, -benchtime 1h30s).
   718  	    The default is 1 second (1s).
   719  
   720  	-blockprofile block.out
   721  	    Write a goroutine blocking profile to the specified file
   722  	    when all tests are complete.
   723  
   724  	-blockprofilerate n
   725  	    Control the detail provided in goroutine blocking profiles by
   726  	    calling runtime.SetBlockProfileRate with n.
   727  	    See 'godoc runtime SetBlockProfileRate'.
   728  	    The profiler aims to sample, on average, one blocking event every
   729  	    n nanoseconds the program spends blocked.  By default,
   730  	    if -test.blockprofile is set without this flag, all blocking events
   731  	    are recorded, equivalent to -test.blockprofilerate=1.
   732  
   733  	-cpu 1,2,4
   734  	    Specify a list of GOMAXPROCS values for which the tests or
   735  	    benchmarks should be executed.  The default is the current value
   736  	    of GOMAXPROCS.
   737  
   738  	-cpuprofile cpu.out
   739  	    Write a CPU profile to the specified file before exiting.
   740  
   741  	-memprofile mem.out
   742  	    Write a memory profile to the specified file after all tests
   743  	    have passed.
   744  
   745  	-memprofilerate n
   746  	    Enable more precise (and expensive) memory profiles by setting
   747  	    runtime.MemProfileRate.  See 'godoc runtime MemProfileRate'.
   748  	    To profile all memory allocations, use -test.memprofilerate=1
   749  	    and set the environment variable GOGC=off to disable the
   750  	    garbage collector, provided the test can run in the available
   751  	    memory without garbage collection.
   752  
   753  	-parallel n
   754  	    Allow parallel execution of test functions that call t.Parallel.
   755  	    The value of this flag is the maximum number of tests to run
   756  	    simultaneously; by default, it is set to the value of GOMAXPROCS.
   757  
   758  	-run regexp
   759  	    Run only those tests and examples matching the regular
   760  	    expression.
   761  
   762  	-short
   763  	    Tell long-running tests to shorten their run time.
   764  	    It is off by default but set during all.bash so that installing
   765  	    the Go tree can run a sanity check but not spend time running
   766  	    exhaustive tests.
   767  
   768  	-timeout t
   769  	    If a test runs longer than t, panic.
   770  
   771  	-v
   772  	    Verbose output: log all tests as they are run. Also print all
   773  	    text from Log and Logf calls even if the test succeeds.
   774  
   775  The test binary, called pkg.test where pkg is the name of the
   776  directory containing the package sources, can be invoked directly
   777  after building it with 'go test -c'. When invoking the test binary
   778  directly, each of the standard flag names must be prefixed with 'test.',
   779  as in -test.run=TestMyFunc or -test.v.
   780  
   781  When running 'go test', flags not listed above are passed through
   782  unaltered. For instance, the command
   783  
   784  	go test -x -v -cpuprofile=prof.out -dir=testdata -update
   785  
   786  will compile the test binary and then run it as
   787  
   788  	pkg.test -test.v -test.cpuprofile=prof.out -dir=testdata -update
   789  
   790  The test flags that generate profiles also leave the test binary in pkg.test
   791  for use when analyzing the profiles.
   792  
   793  Flags not recognized by 'go test' must be placed after any specified packages.
   794  
   795  
   796  Description of testing functions
   797  
   798  The 'go test' command expects to find test, benchmark, and example functions
   799  in the "*_test.go" files corresponding to the package under test.
   800  
   801  A test function is one named TestXXX (where XXX is any alphanumeric string
   802  not starting with a lower case letter) and should have the signature,
   803  
   804  	func TestXXX(t *testing.T) { ... }
   805  
   806  A benchmark function is one named BenchmarkXXX and should have the signature,
   807  
   808  	func BenchmarkXXX(b *testing.B) { ... }
   809  
   810  An example function is similar to a test function but, instead of using
   811  *testing.T to report success or failure, prints output to os.Stdout.
   812  That output is compared against the function's "Output:" comment, which
   813  must be the last comment in the function body (see example below). An
   814  example with no such comment, or with no text after "Output:" is compiled
   815  but not executed.
   816  
   817  Godoc displays the body of ExampleXXX to demonstrate the use
   818  of the function, constant, or variable XXX.  An example of a method M with
   819  receiver type T or *T is named ExampleT_M.  There may be multiple examples
   820  for a given function, constant, or variable, distinguished by a trailing _xxx,
   821  where xxx is a suffix not beginning with an upper case letter.
   822  
   823  Here is an example of an example:
   824  
   825  	func ExamplePrintln() {
   826  		Println("The output of\nthis example.")
   827  		// Output: The output of
   828  		// this example.
   829  	}
   830  
   831  The entire test file is presented as the example when it contains a single
   832  example function, at least one other function, type, variable, or constant
   833  declaration, and no test or benchmark functions.
   834  
   835  See the documentation of the testing package for more information.
   836  
   837  
   838  */
   839  package main
   840  
   841  // NOTE: cmdDoc is in fmt.go.