github.com/jonasi/go@v0.0.0-20150930005915-e78e654c1de0/src/cmd/go/alldocs.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 mkalldocs.sh.
     6  // Edit the documentation in other files and rerun mkalldocs.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         show documentation for package or symbol
    20  	env         print Go environment information
    21  	fix         run go tool fix on packages
    22  	fmt         run gofmt on package sources
    23  	generate    generate Go files by processing source
    24  	get         download and install packages and dependencies
    25  	install     compile and install packages and dependencies
    26  	list        list packages
    27  	run         compile and run Go program
    28  	test        test packages
    29  	tool        run specified go tool
    30  	version     print Go version
    31  	vet         run go tool vet on packages
    32  
    33  Use "go help [command]" for more information about a command.
    34  
    35  Additional help topics:
    36  
    37  	c           calling between Go and C
    38  	buildmode   description of build modes
    39  	filetype    file types
    40  	gopath      GOPATH environment variable
    41  	environment environment variables
    42  	importpath  import path syntax
    43  	packages    description of package lists
    44  	testflag    description of testing flags
    45  	testfunc    description of testing functions
    46  
    47  Use "go help [topic]" for more information about that topic.
    48  
    49  
    50  Compile packages and dependencies
    51  
    52  Usage:
    53  
    54  	go build [-o output] [-i] [build flags] [packages]
    55  
    56  Build compiles the packages named by the import paths,
    57  along with their dependencies, but it does not install the results.
    58  
    59  If the arguments to build are a list of .go files, build treats
    60  them as a list of source files specifying a single package.
    61  
    62  When compiling a single main package, build writes
    63  the resulting executable to an output file named after
    64  the first source file ('go build ed.go rx.go' writes 'ed' or 'ed.exe')
    65  or the source code directory ('go build unix/sam' writes 'sam' or 'sam.exe').
    66  The '.exe' suffix is added when writing a Windows executable.
    67  
    68  When compiling multiple packages or a single non-main package,
    69  build compiles the packages but discards the resulting object,
    70  serving only as a check that the packages can be built.
    71  
    72  The -o flag, only allowed when compiling a single package,
    73  forces build to write the resulting executable or object
    74  to the named output file, instead of the default behavior described
    75  in the last two paragraphs.
    76  
    77  The -i flag installs the packages that are dependencies of the target.
    78  
    79  The build flags are shared by the build, clean, get, install, list, run,
    80  and test commands:
    81  
    82  	-a
    83  		force rebuilding of packages that are already up-to-date.
    84  	-n
    85  		print the commands but do not run them.
    86  	-p n
    87  		the number of builds that can be run in parallel.
    88  		The default is the number of CPUs available, except
    89  		on darwin/arm which defaults to 1.
    90  	-race
    91  		enable data race detection.
    92  		Supported only on linux/amd64, freebsd/amd64, darwin/amd64 and windows/amd64.
    93  	-v
    94  		print the names of packages as they are compiled.
    95  	-work
    96  		print the name of the temporary work directory and
    97  		do not delete it when exiting.
    98  	-x
    99  		print the commands.
   100  
   101  	-asmflags 'flag list'
   102  		arguments to pass on each go tool asm invocation.
   103  	-buildmode mode
   104  		build mode to use. See 'go help buildmode' for more.
   105  	-compiler name
   106  		name of compiler to use, as in runtime.Compiler (gccgo or gc).
   107  	-gccgoflags 'arg list'
   108  		arguments to pass on each gccgo compiler/linker invocation.
   109  	-gcflags 'arg list'
   110  		arguments to pass on each go tool compile invocation.
   111  	-installsuffix suffix
   112  		a suffix to use in the name of the package installation directory,
   113  		in order to keep output separate from default builds.
   114  		If using the -race flag, the install suffix is automatically set to race
   115  		or, if set explicitly, has _race appended to it.  Using a -buildmode
   116  		option that requires non-default compile flags has a similar effect.
   117  	-ldflags 'flag list'
   118  		arguments to pass on each go tool link invocation.
   119  	-linkshared
   120  		link against shared libraries previously created with
   121  		-buildmode=shared
   122  	-pkgdir dir
   123  		install and load all packages from dir instead of the usual locations.
   124  		For example, when building with a non-standard configuration,
   125  		use -pkgdir to keep generated packages in a separate location.
   126  	-tags 'tag list'
   127  		a list of build tags to consider satisfied during the build.
   128  		For more information about build tags, see the description of
   129  		build constraints in the documentation for the go/build package.
   130  	-toolexec 'cmd args'
   131  		a program to use to invoke toolchain programs like vet and asm.
   132  		For example, instead of running asm, the go command will run
   133  		'cmd args /path/to/asm <arguments for asm>'.
   134  
   135  The list flags accept a space-separated list of strings. To embed spaces
   136  in an element in the list, surround it with either single or double quotes.
   137  
   138  For more about specifying packages, see 'go help packages'.
   139  For more about where packages and binaries are installed,
   140  run 'go help gopath'.
   141  For more about calling between Go and C/C++, run 'go help c'.
   142  
   143  Note: Build adheres to certain conventions such as those described
   144  by 'go help gopath'. Not all projects can follow these conventions,
   145  however. Installations that have their own conventions or that use
   146  a separate software build system may choose to use lower-level
   147  invocations such as 'go tool compile' and 'go tool link' to avoid
   148  some of the overheads and design decisions of the build tool.
   149  
   150  See also: go install, go get, go clean.
   151  
   152  
   153  Remove object files
   154  
   155  Usage:
   156  
   157  	go clean [-i] [-r] [-n] [-x] [build flags] [packages]
   158  
   159  Clean removes object files from package source directories.
   160  The go command builds most objects in a temporary directory,
   161  so go clean is mainly concerned with object files left by other
   162  tools or by manual invocations of go build.
   163  
   164  Specifically, clean removes the following files from each of the
   165  source directories corresponding to the import paths:
   166  
   167  	_obj/            old object directory, left from Makefiles
   168  	_test/           old test directory, left from Makefiles
   169  	_testmain.go     old gotest file, left from Makefiles
   170  	test.out         old test log, left from Makefiles
   171  	build.out        old test log, left from Makefiles
   172  	*.[568ao]        object files, left from Makefiles
   173  
   174  	DIR(.exe)        from go build
   175  	DIR.test(.exe)   from go test -c
   176  	MAINFILE(.exe)   from go build MAINFILE.go
   177  	*.so             from SWIG
   178  
   179  In the list, DIR represents the final path element of the
   180  directory, and MAINFILE is the base name of any Go source
   181  file in the directory that is not included when building
   182  the package.
   183  
   184  The -i flag causes clean to remove the corresponding installed
   185  archive or binary (what 'go install' would create).
   186  
   187  The -n flag causes clean to print the remove commands it would execute,
   188  but not run them.
   189  
   190  The -r flag causes clean to be applied recursively to all the
   191  dependencies of the packages named by the import paths.
   192  
   193  The -x flag causes clean to print remove commands as it executes them.
   194  
   195  For more about build flags, see 'go help build'.
   196  
   197  For more about specifying packages, see 'go help packages'.
   198  
   199  
   200  Show documentation for package or symbol
   201  
   202  Usage:
   203  
   204  	go doc [-u] [-c] [package|[package.]symbol[.method]]
   205  
   206  Doc prints the documentation comments associated with the item identified by its
   207  arguments (a package, const, func, type, var, or method) followed by a one-line
   208  summary of each of the first-level items "under" that item (package-level
   209  declarations for a package, methods for a type, etc.).
   210  
   211  Doc accepts zero, one, or two arguments.
   212  
   213  Given no arguments, that is, when run as
   214  
   215  	go doc
   216  
   217  it prints the package documentation for the package in the current directory.
   218  If the package is a command (package main), the exported symbols of the package
   219  are elided from the presentation unless the -cmd flag is provided.
   220  
   221  When run with one argument, the argument is treated as a Go-syntax-like
   222  representation of the item to be documented. What the argument selects depends
   223  on what is installed in GOROOT and GOPATH, as well as the form of the argument,
   224  which is schematically one of these:
   225  
   226  	go doc <pkg>
   227  	go doc <sym>[.<method>]
   228  	go doc [<pkg>.]<sym>[.<method>]
   229  	go doc [<pkg>.][<sym>.]<method>
   230  
   231  The first item in this list matched by the argument is the one whose documentation
   232  is printed. (See the examples below.) However, if the argument starts with a capital
   233  letter it is assumed to identify a symbol or method in the current directory.
   234  
   235  For packages, the order of scanning is determined lexically, but the GOROOT tree
   236  is always scanned before GOPATH.
   237  
   238  If there is no package specified or matched, the package in the current
   239  directory is selected, so "go doc Foo" shows the documentation for symbol Foo in
   240  the current package.
   241  
   242  The package path must be either a qualified path or a proper suffix of a
   243  path. The go tool's usual package mechanism does not apply: package path
   244  elements like . and ... are not implemented by go doc.
   245  
   246  When run with two arguments, the first must be a full package path (not just a
   247  suffix), and the second is a symbol or symbol and method; this is similar to the
   248  syntax accepted by godoc:
   249  
   250  	go doc <pkg> <sym>[.<method>]
   251  
   252  In all forms, when matching symbols, lower-case letters in the argument match
   253  either case but upper-case letters match exactly. This means that there may be
   254  multiple matches of a lower-case argument in a package if different symbols have
   255  different cases. If this occurs, documentation for all matches is printed.
   256  
   257  Examples:
   258  	go doc
   259  		Show documentation for current package.
   260  	go doc Foo
   261  		Show documentation for Foo in the current package.
   262  		(Foo starts with a capital letter so it cannot match
   263  		a package path.)
   264  	go doc encoding/json
   265  		Show documentation for the encoding/json package.
   266  	go doc json
   267  		Shorthand for encoding/json.
   268  	go doc json.Number (or go doc json.number)
   269  		Show documentation and method summary for json.Number.
   270  	go doc json.Number.Int64 (or go doc json.number.int64)
   271  		Show documentation for json.Number's Int64 method.
   272  	go doc cmd/doc
   273  		Show package docs for the doc command.
   274  	go doc -cmd cmd/doc
   275  		Show package docs and exported symbols within the doc command.
   276  	go doc template.new
   277  		Show documentation for html/template's New function.
   278  		(html/template is lexically before text/template)
   279  	go doc text/template.new # One argument
   280  		Show documentation for text/template's New function.
   281  	go doc text/template new # Two arguments
   282  		Show documentation for text/template's New function.
   283  
   284  	At least in the current tree, these invocations all print the
   285  	documentation for json.Decoder's Decode method:
   286  
   287  	go doc json.Decoder.Decode
   288  	go doc json.decoder.decode
   289  	go doc json.decode
   290  	cd go/src/encoding/json; go doc decode
   291  
   292  Flags:
   293  	-c
   294  		Respect case when matching symbols.
   295  	-cmd
   296  		Treat a command (package main) like a regular package.
   297  		Otherwise package main's exported symbols are hidden
   298  		when showing the package's top-level documentation.
   299  	-u
   300  		Show documentation for unexported as well as exported
   301  		symbols and methods.
   302  
   303  
   304  Print Go environment information
   305  
   306  Usage:
   307  
   308  	go env [var ...]
   309  
   310  Env prints Go environment information.
   311  
   312  By default env prints information as a shell script
   313  (on Windows, a batch file).  If one or more variable
   314  names is given as arguments,  env prints the value of
   315  each named variable on its own line.
   316  
   317  
   318  Run go tool fix on packages
   319  
   320  Usage:
   321  
   322  	go fix [packages]
   323  
   324  Fix runs the Go fix command on the packages named by the import paths.
   325  
   326  For more about fix, see 'go doc cmd/fix'.
   327  For more about specifying packages, see 'go help packages'.
   328  
   329  To run fix with specific options, run 'go tool fix'.
   330  
   331  See also: go fmt, go vet.
   332  
   333  
   334  Run gofmt on package sources
   335  
   336  Usage:
   337  
   338  	go fmt [-n] [-x] [packages]
   339  
   340  Fmt runs the command 'gofmt -l -w' on the packages named
   341  by the import paths.  It prints the names of the files that are modified.
   342  
   343  For more about gofmt, see 'go doc cmd/gofmt'.
   344  For more about specifying packages, see 'go help packages'.
   345  
   346  The -n flag prints commands that would be executed.
   347  The -x flag prints commands as they are executed.
   348  
   349  To run gofmt with specific options, run gofmt itself.
   350  
   351  See also: go fix, go vet.
   352  
   353  
   354  Generate Go files by processing source
   355  
   356  Usage:
   357  
   358  	go generate [-run regexp] [file.go... | packages]
   359  
   360  Generate runs commands described by directives within existing
   361  files. Those commands can run any process but the intent is to
   362  create or update Go source files, for instance by running yacc.
   363  
   364  Go generate is never run automatically by go build, go get, go test,
   365  and so on. It must be run explicitly.
   366  
   367  Go generate scans the file for directives, which are lines of
   368  the form,
   369  
   370  	//go:generate command argument...
   371  
   372  (note: no leading spaces and no space in "//go") where command
   373  is the generator to be run, corresponding to an executable file
   374  that can be run locally. It must either be in the shell path
   375  (gofmt), a fully qualified path (/usr/you/bin/mytool), or a
   376  command alias, described below.
   377  
   378  Note that go generate does not parse the file, so lines that look
   379  like directives in comments or multiline strings will be treated
   380  as directives.
   381  
   382  The arguments to the directive are space-separated tokens or
   383  double-quoted strings passed to the generator as individual
   384  arguments when it is run.
   385  
   386  Quoted strings use Go syntax and are evaluated before execution; a
   387  quoted string appears as a single argument to the generator.
   388  
   389  Go generate sets several variables when it runs the generator:
   390  
   391  	$GOARCH
   392  		The execution architecture (arm, amd64, etc.)
   393  	$GOOS
   394  		The execution operating system (linux, windows, etc.)
   395  	$GOFILE
   396  		The base name of the file.
   397  	$GOLINE
   398  		The line number of the directive in the source file.
   399  	$GOPACKAGE
   400  		The name of the package of the file containing the directive.
   401  	$DOLLAR
   402  		A dollar sign.
   403  
   404  Other than variable substitution and quoted-string evaluation, no
   405  special processing such as "globbing" is performed on the command
   406  line.
   407  
   408  As a last step before running the command, any invocations of any
   409  environment variables with alphanumeric names, such as $GOFILE or
   410  $HOME, are expanded throughout the command line. The syntax for
   411  variable expansion is $NAME on all operating systems.  Due to the
   412  order of evaluation, variables are expanded even inside quoted
   413  strings. If the variable NAME is not set, $NAME expands to the
   414  empty string.
   415  
   416  A directive of the form,
   417  
   418  	//go:generate -command xxx args...
   419  
   420  specifies, for the remainder of this source file only, that the
   421  string xxx represents the command identified by the arguments. This
   422  can be used to create aliases or to handle multiword generators.
   423  For example,
   424  
   425  	//go:generate -command yacc go tool yacc
   426  
   427  specifies that the command "yacc" represents the generator
   428  "go tool yacc".
   429  
   430  Generate processes packages in the order given on the command line,
   431  one at a time. If the command line lists .go files, they are treated
   432  as a single package. Within a package, generate processes the
   433  source files in a package in file name order, one at a time. Within
   434  a source file, generate runs generators in the order they appear
   435  in the file, one at a time.
   436  
   437  If any generator returns an error exit status, "go generate" skips
   438  all further processing for that package.
   439  
   440  The generator is run in the package's source directory.
   441  
   442  Go generate accepts one specific flag:
   443  
   444  	-run=""
   445  		if non-empty, specifies a regular expression to select
   446  		directives whose full original source text (excluding
   447  		any trailing spaces and final newline) matches the
   448  		expression.
   449  
   450  It also accepts the standard build flags -v, -n, and -x.
   451  The -v flag prints the names of packages and files as they are
   452  processed.
   453  The -n flag prints commands that would be executed.
   454  The -x flag prints commands as they are executed.
   455  
   456  For more about specifying packages, see 'go help packages'.
   457  
   458  
   459  Download and install packages and dependencies
   460  
   461  Usage:
   462  
   463  	go get [-d] [-f] [-fix] [-insecure] [-t] [-u] [build flags] [packages]
   464  
   465  Get downloads and installs the packages named by the import paths,
   466  along with their dependencies.
   467  
   468  The -d flag instructs get to stop after downloading the packages; that is,
   469  it instructs get not to install the packages.
   470  
   471  The -f flag, valid only when -u is set, forces get -u not to verify that
   472  each package has been checked out from the source control repository
   473  implied by its import path. This can be useful if the source is a local fork
   474  of the original.
   475  
   476  The -fix flag instructs get to run the fix tool on the downloaded packages
   477  before resolving dependencies or building the code.
   478  
   479  The -insecure flag permits fetching from repositories and resolving
   480  custom domains using insecure schemes such as HTTP. Use with caution.
   481  
   482  The -t flag instructs get to also download the packages required to build
   483  the tests for the specified packages.
   484  
   485  The -u flag instructs get to use the network to update the named packages
   486  and their dependencies.  By default, get uses the network to check out
   487  missing packages but does not use it to look for updates to existing packages.
   488  
   489  Get also accepts build flags to control the installation. See 'go help build'.
   490  
   491  When checking out or updating a package, get looks for a branch or tag
   492  that matches the locally installed version of Go. The most important
   493  rule is that if the local installation is running version "go1", get
   494  searches for a branch or tag named "go1". If no such version exists it
   495  retrieves the most recent version of the package.
   496  
   497  Unless vendoring support is disabled (see 'go help gopath'),
   498  when go get checks out or updates a Git repository,
   499  it also updates any git submodules referenced by the repository.
   500  
   501  For more about specifying packages, see 'go help packages'.
   502  
   503  For more about how 'go get' finds source code to
   504  download, see 'go help importpath'.
   505  
   506  See also: go build, go install, go clean.
   507  
   508  
   509  Compile and install packages and dependencies
   510  
   511  Usage:
   512  
   513  	go install [build flags] [packages]
   514  
   515  Install compiles and installs the packages named by the import paths,
   516  along with their dependencies.
   517  
   518  For more about the build flags, see 'go help build'.
   519  For more about specifying packages, see 'go help packages'.
   520  
   521  See also: go build, go get, go clean.
   522  
   523  
   524  List packages
   525  
   526  Usage:
   527  
   528  	go list [-e] [-f format] [-json] [build flags] [packages]
   529  
   530  List lists the packages named by the import paths, one per line.
   531  
   532  The default output shows the package import path:
   533  
   534      bytes
   535      encoding/json
   536      github.com/gorilla/mux
   537      golang.org/x/net/html
   538  
   539  The -f flag specifies an alternate format for the list, using the
   540  syntax of package template.  The default output is equivalent to -f
   541  '{{.ImportPath}}'. The struct being passed to the template is:
   542  
   543      type Package struct {
   544          Dir           string // directory containing package sources
   545          ImportPath    string // import path of package in dir
   546          ImportComment string // path in import comment on package statement
   547          Name          string // package name
   548          Doc           string // package documentation string
   549          Target        string // install path
   550          Shlib         string // the shared library that contains this package (only set when -linkshared)
   551          Goroot        bool   // is this package in the Go root?
   552          Standard      bool   // is this package part of the standard Go library?
   553          Stale         bool   // would 'go install' do anything for this package?
   554          Root          string // Go root or Go path dir containing this package
   555  
   556          // Source files
   557          GoFiles        []string // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles)
   558          CgoFiles       []string // .go sources files that import "C"
   559          IgnoredGoFiles []string // .go sources ignored due to build constraints
   560          CFiles         []string // .c source files
   561          CXXFiles       []string // .cc, .cxx and .cpp source files
   562          MFiles         []string // .m source files
   563          HFiles         []string // .h, .hh, .hpp and .hxx source files
   564          SFiles         []string // .s source files
   565          SwigFiles      []string // .swig files
   566          SwigCXXFiles   []string // .swigcxx files
   567          SysoFiles      []string // .syso object files to add to archive
   568  
   569          // Cgo directives
   570          CgoCFLAGS    []string // cgo: flags for C compiler
   571          CgoCPPFLAGS  []string // cgo: flags for C preprocessor
   572          CgoCXXFLAGS  []string // cgo: flags for C++ compiler
   573          CgoLDFLAGS   []string // cgo: flags for linker
   574          CgoPkgConfig []string // cgo: pkg-config names
   575  
   576          // Dependency information
   577          Imports []string // import paths used by this package
   578          Deps    []string // all (recursively) imported dependencies
   579  
   580          // Error information
   581          Incomplete bool            // this package or a dependency has an error
   582          Error      *PackageError   // error loading package
   583          DepsErrors []*PackageError // errors loading dependencies
   584  
   585          TestGoFiles  []string // _test.go files in package
   586          TestImports  []string // imports from TestGoFiles
   587          XTestGoFiles []string // _test.go files outside package
   588          XTestImports []string // imports from XTestGoFiles
   589      }
   590  
   591  The template function "join" calls strings.Join.
   592  
   593  The template function "context" returns the build context, defined as:
   594  
   595  	type Context struct {
   596  		GOARCH        string   // target architecture
   597  		GOOS          string   // target operating system
   598  		GOROOT        string   // Go root
   599  		GOPATH        string   // Go path
   600  		CgoEnabled    bool     // whether cgo can be used
   601  		UseAllFiles   bool     // use files regardless of +build lines, file names
   602  		Compiler      string   // compiler to assume when computing target paths
   603  		BuildTags     []string // build constraints to match in +build lines
   604  		ReleaseTags   []string // releases the current release is compatible with
   605  		InstallSuffix string   // suffix to use in the name of the install dir
   606  	}
   607  
   608  For more information about the meaning of these fields see the documentation
   609  for the go/build package's Context type.
   610  
   611  The -json flag causes the package data to be printed in JSON format
   612  instead of using the template format.
   613  
   614  The -e flag changes the handling of erroneous packages, those that
   615  cannot be found or are malformed.  By default, the list command
   616  prints an error to standard error for each erroneous package and
   617  omits the packages from consideration during the usual printing.
   618  With the -e flag, the list command never prints errors to standard
   619  error and instead processes the erroneous packages with the usual
   620  printing.  Erroneous packages will have a non-empty ImportPath and
   621  a non-nil Error field; other information may or may not be missing
   622  (zeroed).
   623  
   624  For more about build flags, see 'go help build'.
   625  
   626  For more about specifying packages, see 'go help packages'.
   627  
   628  
   629  Compile and run Go program
   630  
   631  Usage:
   632  
   633  	go run [build flags] [-exec xprog] gofiles... [arguments...]
   634  
   635  Run compiles and runs the main package comprising the named Go source files.
   636  A Go source file is defined to be a file ending in a literal ".go" suffix.
   637  
   638  By default, 'go run' runs the compiled binary directly: 'a.out arguments...'.
   639  If the -exec flag is given, 'go run' invokes the binary using xprog:
   640  	'xprog a.out arguments...'.
   641  If the -exec flag is not given, GOOS or GOARCH is different from the system
   642  default, and a program named go_$GOOS_$GOARCH_exec can be found
   643  on the current search path, 'go run' invokes the binary using that program,
   644  for example 'go_nacl_386_exec a.out arguments...'. This allows execution of
   645  cross-compiled programs when a simulator or other execution method is
   646  available.
   647  
   648  For more about build flags, see 'go help build'.
   649  
   650  See also: go build.
   651  
   652  
   653  Test packages
   654  
   655  Usage:
   656  
   657  	go test [-c] [-i] [build and test flags] [packages] [flags for test binary]
   658  
   659  'Go test' automates testing the packages named by the import paths.
   660  It prints a summary of the test results in the format:
   661  
   662  	ok   archive/tar   0.011s
   663  	FAIL archive/zip   0.022s
   664  	ok   compress/gzip 0.033s
   665  	...
   666  
   667  followed by detailed output for each failed package.
   668  
   669  'Go test' recompiles each package along with any files with names matching
   670  the file pattern "*_test.go".
   671  Files whose names begin with "_" (including "_test.go") or "." are ignored.
   672  These additional files can contain test functions, benchmark functions, and
   673  example functions.  See 'go help testfunc' for more.
   674  Each listed package causes the execution of a separate test binary.
   675  
   676  Test files that declare a package with the suffix "_test" will be compiled as a
   677  separate package, and then linked and run with the main test binary.
   678  
   679  By default, go test needs no arguments.  It compiles and tests the package
   680  with source in the current directory, including tests, and runs the tests.
   681  
   682  The package is built in a temporary directory so it does not interfere with the
   683  non-test installation.
   684  
   685  In addition to the build flags, the flags handled by 'go test' itself are:
   686  
   687  	-c
   688  		Compile the test binary to pkg.test but do not run it
   689  		(where pkg is the last element of the package's import path).
   690  		The file name can be changed with the -o flag.
   691  
   692  	-exec xprog
   693  	    Run the test binary using xprog. The behavior is the same as
   694  	    in 'go run'. See 'go help run' for details.
   695  
   696  	-i
   697  	    Install packages that are dependencies of the test.
   698  	    Do not run the test.
   699  
   700  	-o file
   701  		Compile the test binary to the named file.
   702  		The test still runs (unless -c or -i is specified).
   703  
   704  The test binary also accepts flags that control execution of the test; these
   705  flags are also accessible by 'go test'. See 'go help testflag' for details.
   706  
   707  If the test binary needs any other flags, they should be presented after the
   708  package names. The go tool treats as a flag the first argument that begins with
   709  a minus sign that it does not recognize itself; that argument and all subsequent
   710  arguments are passed as arguments to the test binary.
   711  
   712  For more about build flags, see 'go help build'.
   713  For more about specifying packages, see 'go help packages'.
   714  
   715  See also: go build, go vet.
   716  
   717  
   718  Run specified go tool
   719  
   720  Usage:
   721  
   722  	go tool [-n] command [args...]
   723  
   724  Tool runs the go tool command identified by the arguments.
   725  With no arguments it prints the list of known tools.
   726  
   727  The -n flag causes tool to print the command that would be
   728  executed but not execute it.
   729  
   730  For more about each tool command, see 'go tool command -h'.
   731  
   732  
   733  Print Go version
   734  
   735  Usage:
   736  
   737  	go version
   738  
   739  Version prints the Go version, as reported by runtime.Version.
   740  
   741  
   742  Run go tool vet on packages
   743  
   744  Usage:
   745  
   746  	go vet [-n] [-x] [build flags] [packages]
   747  
   748  Vet runs the Go vet command on the packages named by the import paths.
   749  
   750  For more about vet, see 'go doc cmd/vet'.
   751  For more about specifying packages, see 'go help packages'.
   752  
   753  To run the vet tool with specific options, run 'go tool vet'.
   754  
   755  The -n flag prints commands that would be executed.
   756  The -x flag prints commands as they are executed.
   757  
   758  For more about build flags, see 'go help build'.
   759  
   760  See also: go fmt, go fix.
   761  
   762  
   763  Calling between Go and C
   764  
   765  There are two different ways to call between Go and C/C++ code.
   766  
   767  The first is the cgo tool, which is part of the Go distribution.  For
   768  information on how to use it see the cgo documentation (go doc cmd/cgo).
   769  
   770  The second is the SWIG program, which is a general tool for
   771  interfacing between languages.  For information on SWIG see
   772  http://swig.org/.  When running go build, any file with a .swig
   773  extension will be passed to SWIG.  Any file with a .swigcxx extension
   774  will be passed to SWIG with the -c++ option.
   775  
   776  When either cgo or SWIG is used, go build will pass any .c, .m, .s,
   777  or .S files to the C compiler, and any .cc, .cpp, .cxx files to the C++
   778  compiler.  The CC or CXX environment variables may be set to determine
   779  the C or C++ compiler, respectively, to use.
   780  
   781  
   782  Description of build modes
   783  
   784  The 'go build' and 'go install' commands take a -buildmode argument which
   785  indicates which kind of object file is to be built. Currently supported values
   786  are:
   787  
   788  	-buildmode=archive
   789  		Build the listed non-main packages into .a files. Packages named
   790  		main are ignored.
   791  
   792  	-buildmode=c-archive
   793  		Build the listed main package, plus all packages it imports,
   794  		into a C archive file. The only callable symbols will be those
   795  		functions exported using a cgo //export comment. Requires
   796  		exactly one main package to be listed.
   797  
   798  	-buildmode=c-shared
   799  		Build the listed main packages, plus all packages that they
   800  		import, into C shared libraries. The only callable symbols will
   801  		be those functions exported using a cgo //export comment.
   802  		Non-main packages are ignored.
   803  
   804  	-buildmode=default
   805  		Listed main packages are built into executables and listed
   806  		non-main packages are built into .a files (the default
   807  		behavior).
   808  
   809  	-buildmode=shared
   810  		Combine all the listed non-main packages into a single shared
   811  		library that will be used when building with the -linkshared
   812  		option. Packages named main are ignored.
   813  
   814  	-buildmode=exe
   815  		Build the listed main packages and everything they import into
   816  		executables. Packages not named main are ignored.
   817  
   818  
   819  File types
   820  
   821  The go command examines the contents of a restricted set of files
   822  in each directory. It identifies which files to examine based on
   823  the extension of the file name. These extensions are:
   824  
   825  	.go
   826  		Go source files.
   827  	.c, .h
   828  		C source files.
   829  		If the package uses cgo or SWIG, these will be compiled with the
   830  		OS-native compiler (typically gcc); otherwise they will
   831  		trigger an error.
   832  	.cc, .cpp, .cxx, .hh, .hpp, .hxx
   833  		C++ source files. Only useful with cgo or SWIG, and always
   834  		compiled with the OS-native compiler.
   835  	.m
   836  		Objective-C source files. Only useful with cgo, and always
   837  		compiled with the OS-native compiler.
   838  	.s, .S
   839  		Assembler source files.
   840  		If the package uses cgo or SWIG, these will be assembled with the
   841  		OS-native assembler (typically gcc (sic)); otherwise they
   842  		will be assembled with the Go assembler.
   843  	.swig, .swigcxx
   844  		SWIG definition files.
   845  	.syso
   846  		System object files.
   847  
   848  Files of each of these types except .syso may contain build
   849  constraints, but the go command stops scanning for build constraints
   850  at the first item in the file that is not a blank line or //-style
   851  line comment.
   852  
   853  
   854  GOPATH environment variable
   855  
   856  The Go path is used to resolve import statements.
   857  It is implemented by and documented in the go/build package.
   858  
   859  The GOPATH environment variable lists places to look for Go code.
   860  On Unix, the value is a colon-separated string.
   861  On Windows, the value is a semicolon-separated string.
   862  On Plan 9, the value is a list.
   863  
   864  GOPATH must be set to get, build and install packages outside the
   865  standard Go tree.
   866  
   867  Each directory listed in GOPATH must have a prescribed structure:
   868  
   869  The src directory holds source code.  The path below src
   870  determines the import path or executable name.
   871  
   872  The pkg directory holds installed package objects.
   873  As in the Go tree, each target operating system and
   874  architecture pair has its own subdirectory of pkg
   875  (pkg/GOOS_GOARCH).
   876  
   877  If DIR is a directory listed in the GOPATH, a package with
   878  source in DIR/src/foo/bar can be imported as "foo/bar" and
   879  has its compiled form installed to "DIR/pkg/GOOS_GOARCH/foo/bar.a".
   880  
   881  The bin directory holds compiled commands.
   882  Each command is named for its source directory, but only
   883  the final element, not the entire path.  That is, the
   884  command with source in DIR/src/foo/quux is installed into
   885  DIR/bin/quux, not DIR/bin/foo/quux.  The "foo/" prefix is stripped
   886  so that you can add DIR/bin to your PATH to get at the
   887  installed commands.  If the GOBIN environment variable is
   888  set, commands are installed to the directory it names instead
   889  of DIR/bin.
   890  
   891  Here's an example directory layout:
   892  
   893      GOPATH=/home/user/gocode
   894  
   895      /home/user/gocode/
   896          src/
   897              foo/
   898                  bar/               (go code in package bar)
   899                      x.go
   900                  quux/              (go code in package main)
   901                      y.go
   902          bin/
   903              quux                   (installed command)
   904          pkg/
   905              linux_amd64/
   906                  foo/
   907                      bar.a          (installed package object)
   908  
   909  Go searches each directory listed in GOPATH to find source code,
   910  but new packages are always downloaded into the first directory
   911  in the list.
   912  
   913  See https://golang.org/doc/code.html for an example.
   914  
   915  Internal Directories
   916  
   917  Code in or below a directory named "internal" is importable only
   918  by code in the directory tree rooted at the parent of "internal".
   919  Here's an extended version of the directory layout above:
   920  
   921      /home/user/gocode/
   922          src/
   923              crash/
   924                  bang/              (go code in package bang)
   925                      b.go
   926              foo/                   (go code in package foo)
   927                  f.go
   928                  bar/               (go code in package bar)
   929                      x.go
   930                  internal/
   931                      baz/           (go code in package baz)
   932                          z.go
   933                  quux/              (go code in package main)
   934                      y.go
   935  
   936  
   937  The code in z.go is imported as "foo/internal/baz", but that
   938  import statement can only appear in source files in the subtree
   939  rooted at foo. The source files foo/f.go, foo/bar/x.go, and
   940  foo/quux/y.go can all import "foo/internal/baz", but the source file
   941  crash/bang/b.go cannot.
   942  
   943  See https://golang.org/s/go14internal for details.
   944  
   945  Vendor Directories
   946  
   947  Go 1.6 includes support for using local copies of external dependencies
   948  to satisfy imports of those dependencies, often referred to as vendoring.
   949  
   950  Code below a directory named "vendor" is importable only
   951  by code in the directory tree rooted at the parent of "vendor",
   952  and only using an import path that omits the prefix up to and
   953  including the vendor element.
   954  
   955  Here's the example from the previous section,
   956  but with the "internal" directory renamed to "vendor"
   957  and a new foo/vendor/crash/bang directory added:
   958  
   959      /home/user/gocode/
   960          src/
   961              crash/
   962                  bang/              (go code in package bang)
   963                      b.go
   964              foo/                   (go code in package foo)
   965                  f.go
   966                  bar/               (go code in package bar)
   967                      x.go
   968                  vendor/
   969                      crash/
   970                          bang/      (go code in package bang)
   971                              b.go
   972                      baz/           (go code in package baz)
   973                          z.go
   974                  quux/              (go code in package main)
   975                      y.go
   976  
   977  The same visibility rules apply as for internal, but the code
   978  in z.go is imported as "baz", not as "foo/vendor/baz".
   979  
   980  Code in vendor directories deeper in the source tree shadows
   981  code in higher directories. Within the subtree rooted at foo, an import
   982  of "crash/bang" resolves to "foo/vendor/crash/bang", not the
   983  top-level "crash/bang".
   984  
   985  Code in vendor directories is not subject to import path
   986  checking (see 'go help importpath').
   987  
   988  When 'go get' checks out or updates a git repository, it now also
   989  updates submodules.
   990  
   991  Vendor directories do not affect the placement of new repositories
   992  being checked out for the first time by 'go get': those are always
   993  placed in the main GOPATH, never in a vendor subtree.
   994  
   995  In Go 1.5, as an experiment, setting the environment variable
   996  GO15VENDOREXPERIMENT=1 enabled these features.
   997  As of Go 1.6 they are on by default. To turn them off, set
   998  GO15VENDOREXPERIMENT=0. In Go 1.7, the environment
   999  variable will stop having any effect.
  1000  
  1001  The vendoring semantics are an experiment, and they may change
  1002  in future releases. Once settled, they will be on by default.
  1003  
  1004  See https://golang.org/s/go15vendor for details.
  1005  
  1006  
  1007  Environment variables
  1008  
  1009  The go command, and the tools it invokes, examine a few different
  1010  environment variables. For many of these, you can see the default
  1011  value of on your system by running 'go env NAME', where NAME is the
  1012  name of the variable.
  1013  
  1014  General-purpose environment variables:
  1015  
  1016  	GCCGO
  1017  		The gccgo command to run for 'go build -compiler=gccgo'.
  1018  	GOARCH
  1019  		The architecture, or processor, for which to compile code.
  1020  		Examples are amd64, 386, arm, ppc64.
  1021  	GOBIN
  1022  		The directory where 'go install' will install a command.
  1023  	GOOS
  1024  		The operating system for which to compile code.
  1025  		Examples are linux, darwin, windows, netbsd.
  1026  	GOPATH
  1027  		See 'go help gopath'.
  1028  	GORACE
  1029  		Options for the race detector.
  1030  		See https://golang.org/doc/articles/race_detector.html.
  1031  	GOROOT
  1032  		The root of the go tree.
  1033  
  1034  Environment variables for use with cgo:
  1035  
  1036  	CC
  1037  		The command to use to compile C code.
  1038  	CGO_ENABLED
  1039  		Whether the cgo command is supported.  Either 0 or 1.
  1040  	CGO_CFLAGS
  1041  		Flags that cgo will pass to the compiler when compiling
  1042  		C code.
  1043  	CGO_CPPFLAGS
  1044  		Flags that cgo will pass to the compiler when compiling
  1045  		C or C++ code.
  1046  	CGO_CXXFLAGS
  1047  		Flags that cgo will pass to the compiler when compiling
  1048  		C++ code.
  1049  	CGO_LDFLAGS
  1050  		Flags that cgo will pass to the compiler when linking.
  1051  	CXX
  1052  		The command to use to compile C++ code.
  1053  
  1054  Architecture-specific environment variables:
  1055  
  1056  	GOARM
  1057  		For GOARCH=arm, the ARM architecture for which to compile.
  1058  		Valid values are 5, 6, 7.
  1059  	GO386
  1060  		For GOARCH=386, the floating point instruction set.
  1061  		Valid values are 387, sse2.
  1062  
  1063  Special-purpose environment variables:
  1064  
  1065  	GOROOT_FINAL
  1066  		The root of the installed Go tree, when it is
  1067  		installed in a location other than where it is built.
  1068  		File names in stack traces are rewritten from GOROOT to
  1069  		GOROOT_FINAL.
  1070  	GO15VENDOREXPERIMENT
  1071  		Set to 1 to enable the Go 1.5 vendoring experiment.
  1072  	GO_EXTLINK_ENABLED
  1073  		Whether the linker should use external linking mode
  1074  		when using -linkmode=auto with code that uses cgo.
  1075  		Set to 0 to disable external linking mode, 1 to enable it.
  1076  
  1077  
  1078  Import path syntax
  1079  
  1080  An import path (see 'go help packages') denotes a package
  1081  stored in the local file system.  In general, an import path denotes
  1082  either a standard package (such as "unicode/utf8") or a package
  1083  found in one of the work spaces (see 'go help gopath').
  1084  
  1085  Relative import paths
  1086  
  1087  An import path beginning with ./ or ../ is called a relative path.
  1088  The toolchain supports relative import paths as a shortcut in two ways.
  1089  
  1090  First, a relative path can be used as a shorthand on the command line.
  1091  If you are working in the directory containing the code imported as
  1092  "unicode" and want to run the tests for "unicode/utf8", you can type
  1093  "go test ./utf8" instead of needing to specify the full path.
  1094  Similarly, in the reverse situation, "go test .." will test "unicode" from
  1095  the "unicode/utf8" directory. Relative patterns are also allowed, like
  1096  "go test ./..." to test all subdirectories. See 'go help packages' for details
  1097  on the pattern syntax.
  1098  
  1099  Second, if you are compiling a Go program not in a work space,
  1100  you can use a relative path in an import statement in that program
  1101  to refer to nearby code also not in a work space.
  1102  This makes it easy to experiment with small multipackage programs
  1103  outside of the usual work spaces, but such programs cannot be
  1104  installed with "go install" (there is no work space in which to install them),
  1105  so they are rebuilt from scratch each time they are built.
  1106  To avoid ambiguity, Go programs cannot use relative import paths
  1107  within a work space.
  1108  
  1109  Remote import paths
  1110  
  1111  Certain import paths also
  1112  describe how to obtain the source code for the package using
  1113  a revision control system.
  1114  
  1115  A few common code hosting sites have special syntax:
  1116  
  1117  	Bitbucket (Git, Mercurial)
  1118  
  1119  		import "bitbucket.org/user/project"
  1120  		import "bitbucket.org/user/project/sub/directory"
  1121  
  1122  	GitHub (Git)
  1123  
  1124  		import "github.com/user/project"
  1125  		import "github.com/user/project/sub/directory"
  1126  
  1127  	Google Code Project Hosting (Git, Mercurial, Subversion)
  1128  
  1129  		import "code.google.com/p/project"
  1130  		import "code.google.com/p/project/sub/directory"
  1131  
  1132  		import "code.google.com/p/project.subrepository"
  1133  		import "code.google.com/p/project.subrepository/sub/directory"
  1134  
  1135  	Launchpad (Bazaar)
  1136  
  1137  		import "launchpad.net/project"
  1138  		import "launchpad.net/project/series"
  1139  		import "launchpad.net/project/series/sub/directory"
  1140  
  1141  		import "launchpad.net/~user/project/branch"
  1142  		import "launchpad.net/~user/project/branch/sub/directory"
  1143  
  1144  	IBM DevOps Services (Git)
  1145  
  1146  		import "hub.jazz.net/git/user/project"
  1147  		import "hub.jazz.net/git/user/project/sub/directory"
  1148  
  1149  For code hosted on other servers, import paths may either be qualified
  1150  with the version control type, or the go tool can dynamically fetch
  1151  the import path over https/http and discover where the code resides
  1152  from a <meta> tag in the HTML.
  1153  
  1154  To declare the code location, an import path of the form
  1155  
  1156  	repository.vcs/path
  1157  
  1158  specifies the given repository, with or without the .vcs suffix,
  1159  using the named version control system, and then the path inside
  1160  that repository.  The supported version control systems are:
  1161  
  1162  	Bazaar      .bzr
  1163  	Git         .git
  1164  	Mercurial   .hg
  1165  	Subversion  .svn
  1166  
  1167  For example,
  1168  
  1169  	import "example.org/user/foo.hg"
  1170  
  1171  denotes the root directory of the Mercurial repository at
  1172  example.org/user/foo or foo.hg, and
  1173  
  1174  	import "example.org/repo.git/foo/bar"
  1175  
  1176  denotes the foo/bar directory of the Git repository at
  1177  example.org/repo or repo.git.
  1178  
  1179  When a version control system supports multiple protocols,
  1180  each is tried in turn when downloading.  For example, a Git
  1181  download tries https://, then git+ssh://.
  1182  
  1183  If the import path is not a known code hosting site and also lacks a
  1184  version control qualifier, the go tool attempts to fetch the import
  1185  over https/http and looks for a <meta> tag in the document's HTML
  1186  <head>.
  1187  
  1188  The meta tag has the form:
  1189  
  1190  	<meta name="go-import" content="import-prefix vcs repo-root">
  1191  
  1192  The import-prefix is the import path corresponding to the repository
  1193  root. It must be a prefix or an exact match of the package being
  1194  fetched with "go get". If it's not an exact match, another http
  1195  request is made at the prefix to verify the <meta> tags match.
  1196  
  1197  The meta tag should appear as early in the file as possible.
  1198  In particular, it should appear before any raw JavaScript or CSS,
  1199  to avoid confusing the go command's restricted parser.
  1200  
  1201  The vcs is one of "git", "hg", "svn", etc,
  1202  
  1203  The repo-root is the root of the version control system
  1204  containing a scheme and not containing a .vcs qualifier.
  1205  
  1206  For example,
  1207  
  1208  	import "example.org/pkg/foo"
  1209  
  1210  will result in the following requests:
  1211  
  1212  	https://example.org/pkg/foo?go-get=1 (preferred)
  1213  	http://example.org/pkg/foo?go-get=1  (fallback, only with -insecure)
  1214  
  1215  If that page contains the meta tag
  1216  
  1217  	<meta name="go-import" content="example.org git https://code.org/r/p/exproj">
  1218  
  1219  the go tool will verify that https://example.org/?go-get=1 contains the
  1220  same meta tag and then git clone https://code.org/r/p/exproj into
  1221  GOPATH/src/example.org.
  1222  
  1223  New downloaded packages are written to the first directory
  1224  listed in the GOPATH environment variable (see 'go help gopath').
  1225  
  1226  The go command attempts to download the version of the
  1227  package appropriate for the Go release being used.
  1228  Run 'go help get' for more.
  1229  
  1230  Import path checking
  1231  
  1232  When the custom import path feature described above redirects to a
  1233  known code hosting site, each of the resulting packages has two possible
  1234  import paths, using the custom domain or the known hosting site.
  1235  
  1236  A package statement is said to have an "import comment" if it is immediately
  1237  followed (before the next newline) by a comment of one of these two forms:
  1238  
  1239  	package math // import "path"
  1240  	package math /* import "path" * /
  1241  
  1242  The go command will refuse to install a package with an import comment
  1243  unless it is being referred to by that import path. In this way, import comments
  1244  let package authors make sure the custom import path is used and not a
  1245  direct path to the underlying code hosting site.
  1246  
  1247  If the vendoring experiment is enabled (see 'go help gopath'),
  1248  then import path checking is disabled for code found within vendor trees.
  1249  This makes it possible to copy code into alternate locations in vendor trees
  1250  without needing to update import comments.
  1251  
  1252  See https://golang.org/s/go14customimport for details.
  1253  
  1254  
  1255  Description of package lists
  1256  
  1257  Many commands apply to a set of packages:
  1258  
  1259  	go action [packages]
  1260  
  1261  Usually, [packages] is a list of import paths.
  1262  
  1263  An import path that is a rooted path or that begins with
  1264  a . or .. element is interpreted as a file system path and
  1265  denotes the package in that directory.
  1266  
  1267  Otherwise, the import path P denotes the package found in
  1268  the directory DIR/src/P for some DIR listed in the GOPATH
  1269  environment variable (see 'go help gopath').
  1270  
  1271  If no import paths are given, the action applies to the
  1272  package in the current directory.
  1273  
  1274  There are four reserved names for paths that should not be used
  1275  for packages to be built with the go tool:
  1276  
  1277  - "main" denotes the top-level package in a stand-alone executable.
  1278  
  1279  - "all" expands to all package directories found in all the GOPATH
  1280  trees. For example, 'go list all' lists all the packages on the local
  1281  system.
  1282  
  1283  - "std" is like all but expands to just the packages in the standard
  1284  Go library.
  1285  
  1286  - "cmd" expands to the Go repository's commands and their
  1287  internal libraries.
  1288  
  1289  An import path is a pattern if it includes one or more "..." wildcards,
  1290  each of which can match any string, including the empty string and
  1291  strings containing slashes.  Such a pattern expands to all package
  1292  directories found in the GOPATH trees with names matching the
  1293  patterns.  As a special case, x/... matches x as well as x's subdirectories.
  1294  For example, net/... expands to net and packages in its subdirectories.
  1295  
  1296  An import path can also name a package to be downloaded from
  1297  a remote repository.  Run 'go help importpath' for details.
  1298  
  1299  Every package in a program must have a unique import path.
  1300  By convention, this is arranged by starting each path with a
  1301  unique prefix that belongs to you.  For example, paths used
  1302  internally at Google all begin with 'google', and paths
  1303  denoting remote repositories begin with the path to the code,
  1304  such as 'github.com/user/repo'.
  1305  
  1306  As a special case, if the package list is a list of .go files from a
  1307  single directory, the command is applied to a single synthesized
  1308  package made up of exactly those files, ignoring any build constraints
  1309  in those files and ignoring any other files in the directory.
  1310  
  1311  Directory and file names that begin with "." or "_" are ignored
  1312  by the go tool, as are directories named "testdata".
  1313  
  1314  
  1315  Description of testing flags
  1316  
  1317  The 'go test' command takes both flags that apply to 'go test' itself
  1318  and flags that apply to the resulting test binary.
  1319  
  1320  Several of the flags control profiling and write an execution profile
  1321  suitable for "go tool pprof"; run "go tool pprof -h" for more
  1322  information.  The --alloc_space, --alloc_objects, and --show_bytes
  1323  options of pprof control how the information is presented.
  1324  
  1325  The following flags are recognized by the 'go test' command and
  1326  control the execution of any test:
  1327  
  1328  	-bench regexp
  1329  	    Run benchmarks matching the regular expression.
  1330  	    By default, no benchmarks run. To run all benchmarks,
  1331  	    use '-bench .' or '-bench=.'.
  1332  
  1333  	-benchmem
  1334  	    Print memory allocation statistics for benchmarks.
  1335  
  1336  	-benchtime t
  1337  	    Run enough iterations of each benchmark to take t, specified
  1338  	    as a time.Duration (for example, -benchtime 1h30s).
  1339  	    The default is 1 second (1s).
  1340  
  1341  	-blockprofile block.out
  1342  	    Write a goroutine blocking profile to the specified file
  1343  	    when all tests are complete.
  1344  	    Writes test binary as -c would.
  1345  
  1346  	-blockprofilerate n
  1347  	    Control the detail provided in goroutine blocking profiles by
  1348  	    calling runtime.SetBlockProfileRate with n.
  1349  	    See 'go doc runtime.SetBlockProfileRate'.
  1350  	    The profiler aims to sample, on average, one blocking event every
  1351  	    n nanoseconds the program spends blocked.  By default,
  1352  	    if -test.blockprofile is set without this flag, all blocking events
  1353  	    are recorded, equivalent to -test.blockprofilerate=1.
  1354  
  1355  	-count n
  1356  	    Run each test and benchmark n times (default 1).
  1357  	    If -cpu is set, run n times for each GOMAXPROCS value.
  1358  	    Examples are always run once.
  1359  
  1360  	-cover
  1361  	    Enable coverage analysis.
  1362  
  1363  	-covermode set,count,atomic
  1364  	    Set the mode for coverage analysis for the package[s]
  1365  	    being tested. The default is "set" unless -race is enabled,
  1366  	    in which case it is "atomic".
  1367  	    The values:
  1368  		set: bool: does this statement run?
  1369  		count: int: how many times does this statement run?
  1370  		atomic: int: count, but correct in multithreaded tests;
  1371  			significantly more expensive.
  1372  	    Sets -cover.
  1373  
  1374  	-coverpkg pkg1,pkg2,pkg3
  1375  	    Apply coverage analysis in each test to the given list of packages.
  1376  	    The default is for each test to analyze only the package being tested.
  1377  	    Packages are specified as import paths.
  1378  	    Sets -cover.
  1379  
  1380  	-coverprofile cover.out
  1381  	    Write a coverage profile to the file after all tests have passed.
  1382  	    Sets -cover.
  1383  
  1384  	-cpu 1,2,4
  1385  	    Specify a list of GOMAXPROCS values for which the tests or
  1386  	    benchmarks should be executed.  The default is the current value
  1387  	    of GOMAXPROCS.
  1388  
  1389  	-cpuprofile cpu.out
  1390  	    Write a CPU profile to the specified file before exiting.
  1391  	    Writes test binary as -c would.
  1392  
  1393  	-memprofile mem.out
  1394  	    Write a memory profile to the file after all tests have passed.
  1395  	    Writes test binary as -c would.
  1396  
  1397  	-memprofilerate n
  1398  	    Enable more precise (and expensive) memory profiles by setting
  1399  	    runtime.MemProfileRate.  See 'go doc runtime.MemProfileRate'.
  1400  	    To profile all memory allocations, use -test.memprofilerate=1
  1401  	    and pass --alloc_space flag to the pprof tool.
  1402  
  1403  	-outputdir directory
  1404  	    Place output files from profiling in the specified directory,
  1405  	    by default the directory in which "go test" is running.
  1406  
  1407  	-parallel n
  1408  	    Allow parallel execution of test functions that call t.Parallel.
  1409  	    The value of this flag is the maximum number of tests to run
  1410  	    simultaneously; by default, it is set to the value of GOMAXPROCS.
  1411  
  1412  	-run regexp
  1413  	    Run only those tests and examples matching the regular
  1414  	    expression.
  1415  
  1416  	-short
  1417  	    Tell long-running tests to shorten their run time.
  1418  	    It is off by default but set during all.bash so that installing
  1419  	    the Go tree can run a sanity check but not spend time running
  1420  	    exhaustive tests.
  1421  
  1422  	-timeout t
  1423  	    If a test runs longer than t, panic.
  1424  	    The default is 10 minutes (10m).
  1425  
  1426  	-trace trace.out
  1427  	    Write an execution trace to the specified file before exiting.
  1428  	    Writes test binary as -c would.
  1429  
  1430  	-v
  1431  	    Verbose output: log all tests as they are run. Also print all
  1432  	    text from Log and Logf calls even if the test succeeds.
  1433  
  1434  The test binary, called pkg.test where pkg is the name of the
  1435  directory containing the package sources, can be invoked directly
  1436  after building it with 'go test -c'. When invoking the test binary
  1437  directly, each of the standard flag names must be prefixed with 'test.',
  1438  as in -test.run=TestMyFunc or -test.v.
  1439  
  1440  When running 'go test', flags not listed above are passed through
  1441  unaltered. For instance, the command
  1442  
  1443  	go test -x -v -cpuprofile=prof.out -dir=testdata -update
  1444  
  1445  will compile the test binary and then run it as
  1446  
  1447  	pkg.test -test.v -test.cpuprofile=prof.out -dir=testdata -update
  1448  
  1449  The test flags that generate profiles (other than for coverage) also
  1450  leave the test binary in pkg.test for use when analyzing the profiles.
  1451  
  1452  Flags not recognized by 'go test' must be placed after any specified packages.
  1453  
  1454  
  1455  Description of testing functions
  1456  
  1457  The 'go test' command expects to find test, benchmark, and example functions
  1458  in the "*_test.go" files corresponding to the package under test.
  1459  
  1460  A test function is one named TestXXX (where XXX is any alphanumeric string
  1461  not starting with a lower case letter) and should have the signature,
  1462  
  1463  	func TestXXX(t *testing.T) { ... }
  1464  
  1465  A benchmark function is one named BenchmarkXXX and should have the signature,
  1466  
  1467  	func BenchmarkXXX(b *testing.B) { ... }
  1468  
  1469  An example function is similar to a test function but, instead of using
  1470  *testing.T to report success or failure, prints output to os.Stdout.
  1471  That output is compared against the function's "Output:" comment, which
  1472  must be the last comment in the function body (see example below). An
  1473  example with no such comment, or with no text after "Output:" is compiled
  1474  but not executed.
  1475  
  1476  Godoc displays the body of ExampleXXX to demonstrate the use
  1477  of the function, constant, or variable XXX.  An example of a method M with
  1478  receiver type T or *T is named ExampleT_M.  There may be multiple examples
  1479  for a given function, constant, or variable, distinguished by a trailing _xxx,
  1480  where xxx is a suffix not beginning with an upper case letter.
  1481  
  1482  Here is an example of an example:
  1483  
  1484  	func ExamplePrintln() {
  1485  		Println("The output of\nthis example.")
  1486  		// Output: The output of
  1487  		// this example.
  1488  	}
  1489  
  1490  The entire test file is presented as the example when it contains a single
  1491  example function, at least one other function, type, variable, or constant
  1492  declaration, and no test or benchmark functions.
  1493  
  1494  See the documentation of the testing package for more information.
  1495  
  1496  
  1497  */
  1498  package main