github.com/corona10/go@v0.0.0-20180224231303-7a218942be57/src/cmd/go/internal/help/helpdoc.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  package help
     6  
     7  import "cmd/go/internal/base"
     8  
     9  var HelpC = &base.Command{
    10  	UsageLine: "c",
    11  	Short:     "calling between Go and C",
    12  	Long: `
    13  There are two different ways to call between Go and C/C++ code.
    14  
    15  The first is the cgo tool, which is part of the Go distribution. For
    16  information on how to use it see the cgo documentation (go doc cmd/cgo).
    17  
    18  The second is the SWIG program, which is a general tool for
    19  interfacing between languages. For information on SWIG see
    20  http://swig.org/. When running go build, any file with a .swig
    21  extension will be passed to SWIG. Any file with a .swigcxx extension
    22  will be passed to SWIG with the -c++ option.
    23  
    24  When either cgo or SWIG is used, go build will pass any .c, .m, .s,
    25  or .S files to the C compiler, and any .cc, .cpp, .cxx files to the C++
    26  compiler. The CC or CXX environment variables may be set to determine
    27  the C or C++ compiler, respectively, to use.
    28  	`,
    29  }
    30  
    31  var HelpPackages = &base.Command{
    32  	UsageLine: "packages",
    33  	Short:     "package lists",
    34  	Long: `
    35  Many commands apply to a set of packages:
    36  
    37  	go action [packages]
    38  
    39  Usually, [packages] is a list of import paths.
    40  
    41  An import path that is a rooted path or that begins with
    42  a . or .. element is interpreted as a file system path and
    43  denotes the package in that directory.
    44  
    45  Otherwise, the import path P denotes the package found in
    46  the directory DIR/src/P for some DIR listed in the GOPATH
    47  environment variable (For more details see: 'go help gopath').
    48  
    49  If no import paths are given, the action applies to the
    50  package in the current directory.
    51  
    52  There are four reserved names for paths that should not be used
    53  for packages to be built with the go tool:
    54  
    55  - "main" denotes the top-level package in a stand-alone executable.
    56  
    57  - "all" expands to all package directories found in all the GOPATH
    58  trees. For example, 'go list all' lists all the packages on the local
    59  system.
    60  
    61  - "std" is like all but expands to just the packages in the standard
    62  Go library.
    63  
    64  - "cmd" expands to the Go repository's commands and their
    65  internal libraries.
    66  
    67  Import paths beginning with "cmd/" only match source code in
    68  the Go repository.
    69  
    70  An import path is a pattern if it includes one or more "..." wildcards,
    71  each of which can match any string, including the empty string and
    72  strings containing slashes. Such a pattern expands to all package
    73  directories found in the GOPATH trees with names matching the
    74  patterns.
    75  
    76  To make common patterns more convenient, there are two special cases.
    77  First, /... at the end of the pattern can match an empty string,
    78  so that net/... matches both net and packages in its subdirectories, like net/http.
    79  Second, any slash-separated pattern element containing a wildcard never
    80  participates in a match of the "vendor" element in the path of a vendored
    81  package, so that ./... does not match packages in subdirectories of
    82  ./vendor or ./mycode/vendor, but ./vendor/... and ./mycode/vendor/... do.
    83  Note, however, that a directory named vendor that itself contains code
    84  is not a vendored package: cmd/vendor would be a command named vendor,
    85  and the pattern cmd/... matches it.
    86  See golang.org/s/go15vendor for more about vendoring.
    87  
    88  An import path can also name a package to be downloaded from
    89  a remote repository. Run 'go help importpath' for details.
    90  
    91  Every package in a program must have a unique import path.
    92  By convention, this is arranged by starting each path with a
    93  unique prefix that belongs to you. For example, paths used
    94  internally at Google all begin with 'google', and paths
    95  denoting remote repositories begin with the path to the code,
    96  such as 'github.com/user/repo'.
    97  
    98  Packages in a program need not have unique package names,
    99  but there are two reserved package names with special meaning.
   100  The name main indicates a command, not a library.
   101  Commands are built into binaries and cannot be imported.
   102  The name documentation indicates documentation for
   103  a non-Go program in the directory. Files in package documentation
   104  are ignored by the go command.
   105  
   106  As a special case, if the package list is a list of .go files from a
   107  single directory, the command is applied to a single synthesized
   108  package made up of exactly those files, ignoring any build constraints
   109  in those files and ignoring any other files in the directory.
   110  
   111  Directory and file names that begin with "." or "_" are ignored
   112  by the go tool, as are directories named "testdata".
   113  	`,
   114  }
   115  
   116  var HelpImportPath = &base.Command{
   117  	UsageLine: "importpath",
   118  	Short:     "import path syntax",
   119  	Long: `
   120  
   121  An import path (see 'go help packages') denotes a package stored in the local
   122  file system. In general, an import path denotes either a standard package (such
   123  as "unicode/utf8") or a package found in one of the work spaces (For more
   124  details see: 'go help gopath').
   125  
   126  Relative import paths
   127  
   128  An import path beginning with ./ or ../ is called a relative path.
   129  The toolchain supports relative import paths as a shortcut in two ways.
   130  
   131  First, a relative path can be used as a shorthand on the command line.
   132  If you are working in the directory containing the code imported as
   133  "unicode" and want to run the tests for "unicode/utf8", you can type
   134  "go test ./utf8" instead of needing to specify the full path.
   135  Similarly, in the reverse situation, "go test .." will test "unicode" from
   136  the "unicode/utf8" directory. Relative patterns are also allowed, like
   137  "go test ./..." to test all subdirectories. See 'go help packages' for details
   138  on the pattern syntax.
   139  
   140  Second, if you are compiling a Go program not in a work space,
   141  you can use a relative path in an import statement in that program
   142  to refer to nearby code also not in a work space.
   143  This makes it easy to experiment with small multipackage programs
   144  outside of the usual work spaces, but such programs cannot be
   145  installed with "go install" (there is no work space in which to install them),
   146  so they are rebuilt from scratch each time they are built.
   147  To avoid ambiguity, Go programs cannot use relative import paths
   148  within a work space.
   149  
   150  Remote import paths
   151  
   152  Certain import paths also
   153  describe how to obtain the source code for the package using
   154  a revision control system.
   155  
   156  A few common code hosting sites have special syntax:
   157  
   158  	Bitbucket (Git, Mercurial)
   159  
   160  		import "bitbucket.org/user/project"
   161  		import "bitbucket.org/user/project/sub/directory"
   162  
   163  	GitHub (Git)
   164  
   165  		import "github.com/user/project"
   166  		import "github.com/user/project/sub/directory"
   167  
   168  	Launchpad (Bazaar)
   169  
   170  		import "launchpad.net/project"
   171  		import "launchpad.net/project/series"
   172  		import "launchpad.net/project/series/sub/directory"
   173  
   174  		import "launchpad.net/~user/project/branch"
   175  		import "launchpad.net/~user/project/branch/sub/directory"
   176  
   177  	IBM DevOps Services (Git)
   178  
   179  		import "hub.jazz.net/git/user/project"
   180  		import "hub.jazz.net/git/user/project/sub/directory"
   181  
   182  For code hosted on other servers, import paths may either be qualified
   183  with the version control type, or the go tool can dynamically fetch
   184  the import path over https/http and discover where the code resides
   185  from a <meta> tag in the HTML.
   186  
   187  To declare the code location, an import path of the form
   188  
   189  	repository.vcs/path
   190  
   191  specifies the given repository, with or without the .vcs suffix,
   192  using the named version control system, and then the path inside
   193  that repository. The supported version control systems are:
   194  
   195  	Bazaar      .bzr
   196  	Git         .git
   197  	Mercurial   .hg
   198  	Subversion  .svn
   199  
   200  For example,
   201  
   202  	import "example.org/user/foo.hg"
   203  
   204  denotes the root directory of the Mercurial repository at
   205  example.org/user/foo or foo.hg, and
   206  
   207  	import "example.org/repo.git/foo/bar"
   208  
   209  denotes the foo/bar directory of the Git repository at
   210  example.org/repo or repo.git.
   211  
   212  When a version control system supports multiple protocols,
   213  each is tried in turn when downloading. For example, a Git
   214  download tries https://, then git+ssh://.
   215  
   216  By default, downloads are restricted to known secure protocols
   217  (e.g. https, ssh). To override this setting for Git downloads, the
   218  GIT_ALLOW_PROTOCOL environment variable can be set (For more details see:
   219  'go help environment').
   220  
   221  If the import path is not a known code hosting site and also lacks a
   222  version control qualifier, the go tool attempts to fetch the import
   223  over https/http and looks for a <meta> tag in the document's HTML
   224  <head>.
   225  
   226  The meta tag has the form:
   227  
   228  	<meta name="go-import" content="import-prefix vcs repo-root">
   229  
   230  The import-prefix is the import path corresponding to the repository
   231  root. It must be a prefix or an exact match of the package being
   232  fetched with "go get". If it's not an exact match, another http
   233  request is made at the prefix to verify the <meta> tags match.
   234  
   235  The meta tag should appear as early in the file as possible.
   236  In particular, it should appear before any raw JavaScript or CSS,
   237  to avoid confusing the go command's restricted parser.
   238  
   239  The vcs is one of "git", "hg", "svn", etc,
   240  
   241  The repo-root is the root of the version control system
   242  containing a scheme and not containing a .vcs qualifier.
   243  
   244  For example,
   245  
   246  	import "example.org/pkg/foo"
   247  
   248  will result in the following requests:
   249  
   250  	https://example.org/pkg/foo?go-get=1 (preferred)
   251  	http://example.org/pkg/foo?go-get=1  (fallback, only with -insecure)
   252  
   253  If that page contains the meta tag
   254  
   255  	<meta name="go-import" content="example.org git https://code.org/r/p/exproj">
   256  
   257  the go tool will verify that https://example.org/?go-get=1 contains the
   258  same meta tag and then git clone https://code.org/r/p/exproj into
   259  GOPATH/src/example.org.
   260  
   261  New downloaded packages are written to the first directory listed in the GOPATH
   262  environment variable (For more details see: 'go help gopath').
   263  
   264  The go command attempts to download the version of the
   265  package appropriate for the Go release being used.
   266  Run 'go help get' for more.
   267  
   268  Import path checking
   269  
   270  When the custom import path feature described above redirects to a
   271  known code hosting site, each of the resulting packages has two possible
   272  import paths, using the custom domain or the known hosting site.
   273  
   274  A package statement is said to have an "import comment" if it is immediately
   275  followed (before the next newline) by a comment of one of these two forms:
   276  
   277  	package math // import "path"
   278  	package math /* import "path" */
   279  
   280  The go command will refuse to install a package with an import comment
   281  unless it is being referred to by that import path. In this way, import comments
   282  let package authors make sure the custom import path is used and not a
   283  direct path to the underlying code hosting site.
   284  
   285  Import path checking is disabled for code found within vendor trees.
   286  This makes it possible to copy code into alternate locations in vendor trees
   287  without needing to update import comments.
   288  
   289  See https://golang.org/s/go14customimport for details.
   290  	`,
   291  }
   292  
   293  var HelpGopath = &base.Command{
   294  	UsageLine: "gopath",
   295  	Short:     "GOPATH environment variable",
   296  	Long: `
   297  The Go path is used to resolve import statements.
   298  It is implemented by and documented in the go/build package.
   299  
   300  The GOPATH environment variable lists places to look for Go code.
   301  On Unix, the value is a colon-separated string.
   302  On Windows, the value is a semicolon-separated string.
   303  On Plan 9, the value is a list.
   304  
   305  If the environment variable is unset, GOPATH defaults
   306  to a subdirectory named "go" in the user's home directory
   307  ($HOME/go on Unix, %USERPROFILE%\go on Windows),
   308  unless that directory holds a Go distribution.
   309  Run "go env GOPATH" to see the current GOPATH.
   310  
   311  See https://golang.org/wiki/SettingGOPATH to set a custom GOPATH.
   312  
   313  Each directory listed in GOPATH must have a prescribed structure:
   314  
   315  The src directory holds source code. The path below src
   316  determines the import path or executable name.
   317  
   318  The pkg directory holds installed package objects.
   319  As in the Go tree, each target operating system and
   320  architecture pair has its own subdirectory of pkg
   321  (pkg/GOOS_GOARCH).
   322  
   323  If DIR is a directory listed in the GOPATH, a package with
   324  source in DIR/src/foo/bar can be imported as "foo/bar" and
   325  has its compiled form installed to "DIR/pkg/GOOS_GOARCH/foo/bar.a".
   326  
   327  The bin directory holds compiled commands.
   328  Each command is named for its source directory, but only
   329  the final element, not the entire path. That is, the
   330  command with source in DIR/src/foo/quux is installed into
   331  DIR/bin/quux, not DIR/bin/foo/quux. The "foo/" prefix is stripped
   332  so that you can add DIR/bin to your PATH to get at the
   333  installed commands. If the GOBIN environment variable is
   334  set, commands are installed to the directory it names instead
   335  of DIR/bin. GOBIN must be an absolute path.
   336  
   337  Here's an example directory layout:
   338  
   339      GOPATH=/home/user/go
   340  
   341      /home/user/go/
   342          src/
   343              foo/
   344                  bar/               (go code in package bar)
   345                      x.go
   346                  quux/              (go code in package main)
   347                      y.go
   348          bin/
   349              quux                   (installed command)
   350          pkg/
   351              linux_amd64/
   352                  foo/
   353                      bar.a          (installed package object)
   354  
   355  Go searches each directory listed in GOPATH to find source code,
   356  but new packages are always downloaded into the first directory
   357  in the list.
   358  
   359  See https://golang.org/doc/code.html for an example.
   360  
   361  Internal Directories
   362  
   363  Code in or below a directory named "internal" is importable only
   364  by code in the directory tree rooted at the parent of "internal".
   365  Here's an extended version of the directory layout above:
   366  
   367      /home/user/go/
   368          src/
   369              crash/
   370                  bang/              (go code in package bang)
   371                      b.go
   372              foo/                   (go code in package foo)
   373                  f.go
   374                  bar/               (go code in package bar)
   375                      x.go
   376                  internal/
   377                      baz/           (go code in package baz)
   378                          z.go
   379                  quux/              (go code in package main)
   380                      y.go
   381  
   382  
   383  The code in z.go is imported as "foo/internal/baz", but that
   384  import statement can only appear in source files in the subtree
   385  rooted at foo. The source files foo/f.go, foo/bar/x.go, and
   386  foo/quux/y.go can all import "foo/internal/baz", but the source file
   387  crash/bang/b.go cannot.
   388  
   389  See https://golang.org/s/go14internal for details.
   390  
   391  Vendor Directories
   392  
   393  Go 1.6 includes support for using local copies of external dependencies
   394  to satisfy imports of those dependencies, often referred to as vendoring.
   395  
   396  Code below a directory named "vendor" is importable only
   397  by code in the directory tree rooted at the parent of "vendor",
   398  and only using an import path that omits the prefix up to and
   399  including the vendor element.
   400  
   401  Here's the example from the previous section,
   402  but with the "internal" directory renamed to "vendor"
   403  and a new foo/vendor/crash/bang directory added:
   404  
   405      /home/user/go/
   406          src/
   407              crash/
   408                  bang/              (go code in package bang)
   409                      b.go
   410              foo/                   (go code in package foo)
   411                  f.go
   412                  bar/               (go code in package bar)
   413                      x.go
   414                  vendor/
   415                      crash/
   416                          bang/      (go code in package bang)
   417                              b.go
   418                      baz/           (go code in package baz)
   419                          z.go
   420                  quux/              (go code in package main)
   421                      y.go
   422  
   423  The same visibility rules apply as for internal, but the code
   424  in z.go is imported as "baz", not as "foo/vendor/baz".
   425  
   426  Code in vendor directories deeper in the source tree shadows
   427  code in higher directories. Within the subtree rooted at foo, an import
   428  of "crash/bang" resolves to "foo/vendor/crash/bang", not the
   429  top-level "crash/bang".
   430  
   431  Code in vendor directories is not subject to import path
   432  checking (see 'go help importpath').
   433  
   434  When 'go get' checks out or updates a git repository, it now also
   435  updates submodules.
   436  
   437  Vendor directories do not affect the placement of new repositories
   438  being checked out for the first time by 'go get': those are always
   439  placed in the main GOPATH, never in a vendor subtree.
   440  
   441  See https://golang.org/s/go15vendor for details.
   442  	`,
   443  }
   444  
   445  var HelpEnvironment = &base.Command{
   446  	UsageLine: "environment",
   447  	Short:     "environment variables",
   448  	Long: `
   449  
   450  The go command, and the tools it invokes, examine a few different
   451  environment variables. For many of these, you can see the default
   452  value of on your system by running 'go env NAME', where NAME is the
   453  name of the variable.
   454  
   455  General-purpose environment variables:
   456  
   457  	GCCGO
   458  		The gccgo command to run for 'go build -compiler=gccgo'.
   459  	GOARCH
   460  		The architecture, or processor, for which to compile code.
   461  		Examples are amd64, 386, arm, ppc64.
   462  	GOBIN
   463  		The directory where 'go install' will install a command.
   464  	GOOS
   465  		The operating system for which to compile code.
   466  		Examples are linux, darwin, windows, netbsd.
   467  	GOPATH
   468  		For more details see: 'go help gopath'.
   469  	GORACE
   470  		Options for the race detector.
   471  		See https://golang.org/doc/articles/race_detector.html.
   472  	GOROOT
   473  		The root of the go tree.
   474  	GOTMPDIR
   475  		The directory where the go command will write
   476  		temporary source files, packages, and binaries.
   477  	GOCACHE
   478  		The directory where the go command will store
   479  		cached information for reuse in future builds.
   480  
   481  Environment variables for use with cgo:
   482  
   483  	CC
   484  		The command to use to compile C code.
   485  	CGO_ENABLED
   486  		Whether the cgo command is supported. Either 0 or 1.
   487  	CGO_CFLAGS
   488  		Flags that cgo will pass to the compiler when compiling
   489  		C code.
   490  	CGO_CFLAGS_ALLOW
   491  		A regular expression specifying additional flags to allow
   492  		to appear in #cgo CFLAGS source code directives.
   493  		Does not apply to the CGO_CFLAGS environment variable.
   494  	CGO_CFLAGS_DISALLOW
   495  		A regular expression specifying flags that must be disallowed
   496  		from appearing in #cgo CFLAGS source code directives.
   497  		Does not apply to the CGO_CFLAGS environment variable.
   498  	CGO_CPPFLAGS, CGO_CPPFLAGS_ALLOW, CGO_CPPFLAGS_DISALLOW
   499  		Like CGO_CFLAGS, CGO_CFLAGS_ALLOW, and CGO_CFLAGS_DISALLOW,
   500  		but for the C preprocessor.
   501  	CGO_CXXFLAGS, CGO_CXXFLAGS_ALLOW, CGO_CXXFLAGS_DISALLOW
   502  		Like CGO_CFLAGS, CGO_CFLAGS_ALLOW, and CGO_CFLAGS_DISALLOW,
   503  		but for the C++ compiler.
   504  	CGO_FFLAGS, CGO_FFLAGS_ALLOW, CGO_FFLAGS_DISALLOW
   505  		Like CGO_CFLAGS, CGO_CFLAGS_ALLOW, and CGO_CFLAGS_DISALLOW,
   506  		but for the Fortran compiler.
   507  	CGO_LDFLAGS, CGO_LDFLAGS_ALLOW, CGO_LDFLAGS_DISALLOW
   508  		Like CGO_CFLAGS, CGO_CFLAGS_ALLOW, and CGO_CFLAGS_DISALLOW,
   509  		but for the linker.
   510  	CXX
   511  		The command to use to compile C++ code.
   512  	PKG_CONFIG
   513  		Path to pkg-config tool.
   514  
   515  Architecture-specific environment variables:
   516  
   517  	GOARM
   518  		For GOARCH=arm, the ARM architecture for which to compile.
   519  		Valid values are 5, 6, 7.
   520  	GO386
   521  		For GOARCH=386, the floating point instruction set.
   522  		Valid values are 387, sse2.
   523  	GOMIPS
   524  		For GOARCH=mips{,le}, whether to use floating point instructions.
   525  		Valid values are hardfloat (default), softfloat.
   526  
   527  Special-purpose environment variables:
   528  
   529  	GOROOT_FINAL
   530  		The root of the installed Go tree, when it is
   531  		installed in a location other than where it is built.
   532  		File names in stack traces are rewritten from GOROOT to
   533  		GOROOT_FINAL.
   534  	GO_EXTLINK_ENABLED
   535  		Whether the linker should use external linking mode
   536  		when using -linkmode=auto with code that uses cgo.
   537  		Set to 0 to disable external linking mode, 1 to enable it.
   538  	GIT_ALLOW_PROTOCOL
   539  		Defined by Git. A colon-separated list of schemes that are allowed to be used
   540  		with git fetch/clone. If set, any scheme not explicitly mentioned will be
   541  		considered insecure by 'go get'.
   542  	`,
   543  }
   544  
   545  var HelpFileType = &base.Command{
   546  	UsageLine: "filetype",
   547  	Short:     "file types",
   548  	Long: `
   549  The go command examines the contents of a restricted set of files
   550  in each directory. It identifies which files to examine based on
   551  the extension of the file name. These extensions are:
   552  
   553  	.go
   554  		Go source files.
   555  	.c, .h
   556  		C source files.
   557  		If the package uses cgo or SWIG, these will be compiled with the
   558  		OS-native compiler (typically gcc); otherwise they will
   559  		trigger an error.
   560  	.cc, .cpp, .cxx, .hh, .hpp, .hxx
   561  		C++ source files. Only useful with cgo or SWIG, and always
   562  		compiled with the OS-native compiler.
   563  	.m
   564  		Objective-C source files. Only useful with cgo, and always
   565  		compiled with the OS-native compiler.
   566  	.s, .S
   567  		Assembler source files.
   568  		If the package uses cgo or SWIG, these will be assembled with the
   569  		OS-native assembler (typically gcc (sic)); otherwise they
   570  		will be assembled with the Go assembler.
   571  	.swig, .swigcxx
   572  		SWIG definition files.
   573  	.syso
   574  		System object files.
   575  
   576  Files of each of these types except .syso may contain build
   577  constraints, but the go command stops scanning for build constraints
   578  at the first item in the file that is not a blank line or //-style
   579  line comment. See the go/build package documentation for
   580  more details.
   581  
   582  Non-test Go source files can also include a //go:binary-only-package
   583  comment, indicating that the package sources are included
   584  for documentation only and must not be used to build the
   585  package binary. This enables distribution of Go packages in
   586  their compiled form alone. Even binary-only packages require
   587  accurate import blocks listing required dependencies, so that
   588  those dependencies can be supplied when linking the resulting
   589  command.
   590  	`,
   591  }
   592  
   593  var HelpBuildmode = &base.Command{
   594  	UsageLine: "buildmode",
   595  	Short:     "build modes",
   596  	Long: `
   597  The 'go build' and 'go install' commands take a -buildmode argument which
   598  indicates which kind of object file is to be built. Currently supported values
   599  are:
   600  
   601  	-buildmode=archive
   602  		Build the listed non-main packages into .a files. Packages named
   603  		main are ignored.
   604  
   605  	-buildmode=c-archive
   606  		Build the listed main package, plus all packages it imports,
   607  		into a C archive file. The only callable symbols will be those
   608  		functions exported using a cgo //export comment. Requires
   609  		exactly one main package to be listed.
   610  
   611  	-buildmode=c-shared
   612  		Build the listed main package, plus all packages it imports,
   613  		into a C shared library. The only callable symbols will
   614  		be those functions exported using a cgo //export comment.
   615  		Requires exactly one main package to be listed.
   616  
   617  	-buildmode=default
   618  		Listed main packages are built into executables and listed
   619  		non-main packages are built into .a files (the default
   620  		behavior).
   621  
   622  	-buildmode=shared
   623  		Combine all the listed non-main packages into a single shared
   624  		library that will be used when building with the -linkshared
   625  		option. Packages named main are ignored.
   626  
   627  	-buildmode=exe
   628  		Build the listed main packages and everything they import into
   629  		executables. Packages not named main are ignored.
   630  
   631  	-buildmode=pie
   632  		Build the listed main packages and everything they import into
   633  		position independent executables (PIE). Packages not named
   634  		main are ignored.
   635  
   636  	-buildmode=plugin
   637  		Build the listed main packages, plus all packages that they
   638  		import, into a Go plugin. Packages not named main are ignored.
   639  `,
   640  }
   641  
   642  var HelpCache = &base.Command{
   643  	UsageLine: "cache",
   644  	Short:     "build and test caching",
   645  	Long: `
   646  The go command caches build outputs for reuse in future builds.
   647  The default location for cache data is a subdirectory named go-build
   648  in the standard user cache directory for the current operating system.
   649  Setting the GOCACHE environment variable overrides this default,
   650  and running 'go env GOCACHE' prints the current cache directory.
   651  
   652  The go command periodically deletes cached data that has not been
   653  used recently. Running 'go clean -cache' deletes all cached data.
   654  
   655  The build cache correctly accounts for changes to Go source files,
   656  compilers, compiler options, and so on: cleaning the cache explicitly
   657  should not be necessary in typical use. However, the build cache
   658  does not detect changes to C libraries imported with cgo.
   659  If you have made changes to the C libraries on your system, you
   660  will need to clean the cache explicitly or else use the -a build flag
   661  (see 'go help build') to force rebuilding of packages that
   662  depend on the updated C libraries.
   663  
   664  The go command also caches successful package test results.
   665  See 'go help test' for details. Running 'go clean -testcache' removes
   666  all cached test results (but not cached build results).
   667  
   668  The GODEBUG environment variable can enable printing of debugging
   669  information about the state of the cache:
   670  
   671  GODEBUG=gocacheverify=1 causes the go command to bypass the
   672  use of any cache entries and instead rebuild everything and check
   673  that the results match existing cache entries.
   674  
   675  GODEBUG=gocachehash=1 causes the go command to print the inputs
   676  for all of the content hashes it uses to construct cache lookup keys.
   677  The output is voluminous but can be useful for debugging the cache.
   678  
   679  GODEBUG=gocachetest=1 causes the go command to print details of its
   680  decisions about whether to reuse a cached test result.
   681  `,
   682  }