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