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.
5 // Code generated by mkalldocs.sh; DO NOT EDIT.
6 // Edit the documentation in other files and rerun mkalldocs.sh to generate this one.
8 // Go is a tool for managing Go source code.
12 // go <command> [arguments]
16 // bug start a bug report
17 // build compile packages and dependencies
18 // clean remove object files and cached files
19 // doc show documentation for package or symbol
20 // env print Go environment information
21 // fix update packages to use new APIs
22 // fmt gofmt (reformat) package sources
23 // generate generate Go files by processing source
24 // get add dependencies to current module and install them
25 // install compile and install packages and dependencies
26 // list list packages or modules
27 // mod module maintenance
28 // run compile and run Go program
30 // tool run specified go tool
31 // version print Go version
32 // vet report likely mistakes in packages
34 // Use "go help <command>" for more information about a command.
36 // Additional help topics:
38 // buildconstraint build constraints
39 // buildmode build modes
40 // c calling between Go and C
41 // cache build and test caching
42 // environment environment variables
43 // filetype file types
44 // go.mod the go.mod file
45 // gopath GOPATH environment variable
46 // gopath-get legacy GOPATH go get
47 // goproxy module proxy protocol
48 // importpath import path syntax
49 // modules modules, module versions, and more
50 // module-get module-aware go get
51 // module-auth module authentication using go.sum
52 // packages package lists and patterns
53 // private configuration for downloading non-public code
54 // testflag testing flags
55 // testfunc testing functions
56 // vcs controlling version control with GOVCS
58 // Use "go help <topic>" for more information about that topic.
67 // Bug opens the default browser and starts a new bug report.
68 // The report includes useful system information.
71 // Compile packages and dependencies
75 // go build [-o output] [build flags] [packages]
77 // Build compiles the packages named by the import paths,
78 // along with their dependencies, but it does not install the results.
80 // If the arguments to build are a list of .go files from a single directory,
81 // build treats them as a list of source files specifying a single package.
83 // When compiling packages, build ignores files that end in '_test.go'.
85 // When compiling a single main package, build writes
86 // the resulting executable to an output file named after
87 // the first source file ('go build ed.go rx.go' writes 'ed' or 'ed.exe')
88 // or the source code directory ('go build unix/sam' writes 'sam' or 'sam.exe').
89 // The '.exe' suffix is added when writing a Windows executable.
91 // When compiling multiple packages or a single non-main package,
92 // build compiles the packages but discards the resulting object,
93 // serving only as a check that the packages can be built.
95 // The -o flag forces build to write the resulting executable or object
96 // to the named output file or directory, instead of the default behavior described
97 // in the last two paragraphs. If the named output is an existing directory or
98 // ends with a slash or backslash, then any resulting executables
99 // will be written to that directory.
101 // The -i flag installs the packages that are dependencies of the target.
102 // The -i flag is deprecated. Compiled packages are cached automatically.
104 // The build flags are shared by the build, clean, get, install, list, run,
105 // and test commands:
108 // force rebuilding of packages that are already up-to-date.
110 // print the commands but do not run them.
112 // the number of programs, such as build commands or
113 // test binaries, that can be run in parallel.
114 // The default is GOMAXPROCS, normally the number of CPUs available.
116 // enable data race detection.
117 // Supported only on linux/amd64, freebsd/amd64, darwin/amd64, windows/amd64,
118 // linux/ppc64le and linux/arm64 (only for 48-bit VMA).
120 // enable interoperation with memory sanitizer.
121 // Supported only on linux/amd64, linux/arm64
122 // and only with Clang/LLVM as the host C compiler.
123 // On linux/arm64, pie build mode will be used.
125 // print the names of packages as they are compiled.
127 // print the name of the temporary work directory and
128 // do not delete it when exiting.
130 // print the commands.
132 // -asmflags '[pattern=]arg list'
133 // arguments to pass on each go tool asm invocation.
135 // build mode to use. See 'go help buildmode' for more.
137 // name of compiler to use, as in runtime.Compiler (gccgo or gc).
138 // -gccgoflags '[pattern=]arg list'
139 // arguments to pass on each gccgo compiler/linker invocation.
140 // -gcflags '[pattern=]arg list'
141 // arguments to pass on each go tool compile invocation.
142 // -installsuffix suffix
143 // a suffix to use in the name of the package installation directory,
144 // in order to keep output separate from default builds.
145 // If using the -race flag, the install suffix is automatically set to race
146 // or, if set explicitly, has _race appended to it. Likewise for the -msan
147 // flag. Using a -buildmode option that requires non-default compile flags
148 // has a similar effect.
149 // -ldflags '[pattern=]arg list'
150 // arguments to pass on each go tool link invocation.
152 // build code that will be linked against shared libraries previously
153 // created with -buildmode=shared.
155 // module download mode to use: readonly, vendor, or mod.
156 // By default, if a vendor directory is present and the go version in go.mod
157 // is 1.14 or higher, the go command acts as if -mod=vendor were set.
158 // Otherwise, the go command acts as if -mod=readonly were set.
159 // See https://golang.org/ref/mod#build-commands for details.
161 // leave newly-created directories in the module cache read-write
162 // instead of making them read-only.
164 // in module aware mode, read (and possibly write) an alternate go.mod
165 // file instead of the one in the module root directory. A file named
166 // "go.mod" must still be present in order to determine the module root
167 // directory, but it is not accessed. When -modfile is specified, an
168 // alternate go.sum file is also used: its path is derived from the
169 // -modfile flag by trimming the ".mod" extension and appending ".sum".
171 // read a JSON config file that provides an overlay for build operations.
172 // The file is a JSON struct with a single field, named 'Replace', that
173 // maps each disk file path (a string) to its backing file path, so that
174 // a build will run as if the disk file path exists with the contents
175 // given by the backing file paths, or as if the disk file path does not
176 // exist if its backing file path is empty. Support for the -overlay flag
177 // has some limitations:importantly, cgo files included from outside the
178 // include path must be in the same directory as the Go package they are
179 // included from, and overlays will not appear when binaries and tests are
180 // run through go run and go test respectively.
182 // install and load all packages from dir instead of the usual locations.
183 // For example, when building with a non-standard configuration,
184 // use -pkgdir to keep generated packages in a separate location.
186 // a comma-separated list of build tags to consider satisfied during the
187 // build. For more information about build tags, see the description of
188 // build constraints in the documentation for the go/build package.
189 // (Earlier versions of Go used a space-separated list, and that form
190 // is deprecated but still recognized.)
192 // remove all file system paths from the resulting executable.
193 // Instead of absolute file system paths, the recorded file names
194 // will begin with either "go" (for the standard library),
195 // or a module path@version (when using modules),
196 // or a plain import path (when using GOPATH).
197 // -toolexec 'cmd args'
198 // a program to use to invoke toolchain programs like vet and asm.
199 // For example, instead of running asm, the go command will run
200 // 'cmd args /path/to/asm <arguments for asm>'.
202 // The -asmflags, -gccgoflags, -gcflags, and -ldflags flags accept a
203 // space-separated list of arguments to pass to an underlying tool
204 // during the build. To embed spaces in an element in the list, surround
205 // it with either single or double quotes. The argument list may be
206 // preceded by a package pattern and an equal sign, which restricts
207 // the use of that argument list to the building of packages matching
208 // that pattern (see 'go help packages' for a description of package
209 // patterns). Without a pattern, the argument list applies only to the
210 // packages named on the command line. The flags may be repeated
211 // with different patterns in order to specify different arguments for
212 // different sets of packages. If a package matches patterns given in
213 // multiple flags, the latest match on the command line wins.
214 // For example, 'go build -gcflags=-S fmt' prints the disassembly
215 // only for package fmt, while 'go build -gcflags=all=-S fmt'
216 // prints the disassembly for fmt and all its dependencies.
218 // For more about specifying packages, see 'go help packages'.
219 // For more about where packages and binaries are installed,
220 // run 'go help gopath'.
221 // For more about calling between Go and C/C++, run 'go help c'.
223 // Note: Build adheres to certain conventions such as those described
224 // by 'go help gopath'. Not all projects can follow these conventions,
225 // however. Installations that have their own conventions or that use
226 // a separate software build system may choose to use lower-level
227 // invocations such as 'go tool compile' and 'go tool link' to avoid
228 // some of the overheads and design decisions of the build tool.
230 // See also: go install, go get, go clean.
233 // Remove object files and cached files
237 // go clean [clean flags] [build flags] [packages]
239 // Clean removes object files from package source directories.
240 // The go command builds most objects in a temporary directory,
241 // so go clean is mainly concerned with object files left by other
242 // tools or by manual invocations of go build.
244 // If a package argument is given or the -i or -r flag is set,
245 // clean removes the following files from each of the
246 // source directories corresponding to the import paths:
248 // _obj/ old object directory, left from Makefiles
249 // _test/ old test directory, left from Makefiles
250 // _testmain.go old gotest file, left from Makefiles
251 // test.out old test log, left from Makefiles
252 // build.out old test log, left from Makefiles
253 // *.[568ao] object files, left from Makefiles
255 // DIR(.exe) from go build
256 // DIR.test(.exe) from go test -c
257 // MAINFILE(.exe) from go build MAINFILE.go
260 // In the list, DIR represents the final path element of the
261 // directory, and MAINFILE is the base name of any Go source
262 // file in the directory that is not included when building
265 // The -i flag causes clean to remove the corresponding installed
266 // archive or binary (what 'go install' would create).
268 // The -n flag causes clean to print the remove commands it would execute,
271 // The -r flag causes clean to be applied recursively to all the
272 // dependencies of the packages named by the import paths.
274 // The -x flag causes clean to print remove commands as it executes them.
276 // The -cache flag causes clean to remove the entire go build cache.
278 // The -testcache flag causes clean to expire all test results in the
281 // The -modcache flag causes clean to remove the entire module
282 // download cache, including unpacked source code of versioned
285 // For more about build flags, see 'go help build'.
287 // For more about specifying packages, see 'go help packages'.
290 // Show documentation for package or symbol
294 // go doc [-u] [-c] [package|[package.]symbol[.methodOrField]]
296 // Doc prints the documentation comments associated with the item identified by its
297 // arguments (a package, const, func, type, var, method, or struct field)
298 // followed by a one-line summary of each of the first-level items "under"
299 // that item (package-level declarations for a package, methods for a type,
302 // Doc accepts zero, one, or two arguments.
304 // Given no arguments, that is, when run as
308 // it prints the package documentation for the package in the current directory.
309 // If the package is a command (package main), the exported symbols of the package
310 // are elided from the presentation unless the -cmd flag is provided.
312 // When run with one argument, the argument is treated as a Go-syntax-like
313 // representation of the item to be documented. What the argument selects depends
314 // on what is installed in GOROOT and GOPATH, as well as the form of the argument,
315 // which is schematically one of these:
318 // go doc <sym>[.<methodOrField>]
319 // go doc [<pkg>.]<sym>[.<methodOrField>]
320 // go doc [<pkg>.][<sym>.]<methodOrField>
322 // The first item in this list matched by the argument is the one whose documentation
323 // is printed. (See the examples below.) However, if the argument starts with a capital
324 // letter it is assumed to identify a symbol or method in the current directory.
326 // For packages, the order of scanning is determined lexically in breadth-first order.
327 // That is, the package presented is the one that matches the search and is nearest
328 // the root and lexically first at its level of the hierarchy. The GOROOT tree is
329 // always scanned in its entirety before GOPATH.
331 // If there is no package specified or matched, the package in the current
332 // directory is selected, so "go doc Foo" shows the documentation for symbol Foo in
333 // the current package.
335 // The package path must be either a qualified path or a proper suffix of a
336 // path. The go tool's usual package mechanism does not apply: package path
337 // elements like . and ... are not implemented by go doc.
339 // When run with two arguments, the first must be a full package path (not just a
340 // suffix), and the second is a symbol, or symbol with method or struct field.
341 // This is similar to the syntax accepted by godoc:
343 // go doc <pkg> <sym>[.<methodOrField>]
345 // In all forms, when matching symbols, lower-case letters in the argument match
346 // either case but upper-case letters match exactly. This means that there may be
347 // multiple matches of a lower-case argument in a package if different symbols have
348 // different cases. If this occurs, documentation for all matches is printed.
352 // Show documentation for current package.
354 // Show documentation for Foo in the current package.
355 // (Foo starts with a capital letter so it cannot match
357 // go doc encoding/json
358 // Show documentation for the encoding/json package.
360 // Shorthand for encoding/json.
361 // go doc json.Number (or go doc json.number)
362 // Show documentation and method summary for json.Number.
363 // go doc json.Number.Int64 (or go doc json.number.int64)
364 // Show documentation for json.Number's Int64 method.
366 // Show package docs for the doc command.
367 // go doc -cmd cmd/doc
368 // Show package docs and exported symbols within the doc command.
369 // go doc template.new
370 // Show documentation for html/template's New function.
371 // (html/template is lexically before text/template)
372 // go doc text/template.new # One argument
373 // Show documentation for text/template's New function.
374 // go doc text/template new # Two arguments
375 // Show documentation for text/template's New function.
377 // At least in the current tree, these invocations all print the
378 // documentation for json.Decoder's Decode method:
380 // go doc json.Decoder.Decode
381 // go doc json.decoder.decode
382 // go doc json.decode
383 // cd go/src/encoding/json; go doc decode
387 // Show all the documentation for the package.
389 // Respect case when matching symbols.
391 // Treat a command (package main) like a regular package.
392 // Otherwise package main's exported symbols are hidden
393 // when showing the package's top-level documentation.
395 // One-line representation for each symbol.
397 // Show the full source code for the symbol. This will
398 // display the full Go source of its declaration and
399 // definition, such as a function definition (including
400 // the body), type declaration or enclosing const
401 // block. The output may therefore include unexported
404 // Show documentation for unexported as well as exported
405 // symbols, methods, and fields.
408 // Print Go environment information
412 // go env [-json] [-u] [-w] [var ...]
414 // Env prints Go environment information.
416 // By default env prints information as a shell script
417 // (on Windows, a batch file). If one or more variable
418 // names is given as arguments, env prints the value of
419 // each named variable on its own line.
421 // The -json flag prints the environment in JSON format
422 // instead of as a shell script.
424 // The -u flag requires one or more arguments and unsets
425 // the default setting for the named environment variables,
426 // if one has been set with 'go env -w'.
428 // The -w flag requires one or more arguments of the
429 // form NAME=VALUE and changes the default settings
430 // of the named environment variables to the given values.
432 // For more about environment variables, see 'go help environment'.
435 // Update packages to use new APIs
441 // Fix runs the Go fix command on the packages named by the import paths.
443 // For more about fix, see 'go doc cmd/fix'.
444 // For more about specifying packages, see 'go help packages'.
446 // To run fix with specific options, run 'go tool fix'.
448 // See also: go fmt, go vet.
451 // Gofmt (reformat) package sources
455 // go fmt [-n] [-x] [packages]
457 // Fmt runs the command 'gofmt -l -w' on the packages named
458 // by the import paths. It prints the names of the files that are modified.
460 // For more about gofmt, see 'go doc cmd/gofmt'.
461 // For more about specifying packages, see 'go help packages'.
463 // The -n flag prints commands that would be executed.
464 // The -x flag prints commands as they are executed.
466 // The -mod flag's value sets which module download mode
467 // to use: readonly or vendor. See 'go help modules' for more.
469 // To run gofmt with specific options, run gofmt itself.
471 // See also: go fix, go vet.
474 // Generate Go files by processing source
478 // go generate [-run regexp] [-n] [-v] [-x] [build flags] [file.go... | packages]
480 // Generate runs commands described by directives within existing
481 // files. Those commands can run any process but the intent is to
482 // create or update Go source files.
484 // Go generate is never run automatically by go build, go get, go test,
485 // and so on. It must be run explicitly.
487 // Go generate scans the file for directives, which are lines of
490 // //go:generate command argument...
492 // (note: no leading spaces and no space in "//go") where command
493 // is the generator to be run, corresponding to an executable file
494 // that can be run locally. It must either be in the shell path
495 // (gofmt), a fully qualified path (/usr/you/bin/mytool), or a
496 // command alias, described below.
498 // Note that go generate does not parse the file, so lines that look
499 // like directives in comments or multiline strings will be treated
502 // The arguments to the directive are space-separated tokens or
503 // double-quoted strings passed to the generator as individual
504 // arguments when it is run.
506 // Quoted strings use Go syntax and are evaluated before execution; a
507 // quoted string appears as a single argument to the generator.
509 // To convey to humans and machine tools that code is generated,
510 // generated source should have a line that matches the following
511 // regular expression (in Go syntax):
513 // ^// Code generated .* DO NOT EDIT\.$
515 // This line must appear before the first non-comment, non-blank
518 // Go generate sets several variables when it runs the generator:
521 // The execution architecture (arm, amd64, etc.)
523 // The execution operating system (linux, windows, etc.)
525 // The base name of the file.
527 // The line number of the directive in the source file.
529 // The name of the package of the file containing the directive.
533 // Other than variable substitution and quoted-string evaluation, no
534 // special processing such as "globbing" is performed on the command
537 // As a last step before running the command, any invocations of any
538 // environment variables with alphanumeric names, such as $GOFILE or
539 // $HOME, are expanded throughout the command line. The syntax for
540 // variable expansion is $NAME on all operating systems. Due to the
541 // order of evaluation, variables are expanded even inside quoted
542 // strings. If the variable NAME is not set, $NAME expands to the
545 // A directive of the form,
547 // //go:generate -command xxx args...
549 // specifies, for the remainder of this source file only, that the
550 // string xxx represents the command identified by the arguments. This
551 // can be used to create aliases or to handle multiword generators.
554 // //go:generate -command foo go tool foo
556 // specifies that the command "foo" represents the generator
559 // Generate processes packages in the order given on the command line,
560 // one at a time. If the command line lists .go files from a single directory,
561 // they are treated as a single package. Within a package, generate processes the
562 // source files in a package in file name order, one at a time. Within
563 // a source file, generate runs generators in the order they appear
564 // in the file, one at a time. The go generate tool also sets the build
565 // tag "generate" so that files may be examined by go generate but ignored
568 // For packages with invalid code, generate processes only source files with a
569 // valid package clause.
571 // If any generator returns an error exit status, "go generate" skips
572 // all further processing for that package.
574 // The generator is run in the package's source directory.
576 // Go generate accepts one specific flag:
579 // if non-empty, specifies a regular expression to select
580 // directives whose full original source text (excluding
581 // any trailing spaces and final newline) matches the
584 // It also accepts the standard build flags including -v, -n, and -x.
585 // The -v flag prints the names of packages and files as they are
587 // The -n flag prints commands that would be executed.
588 // The -x flag prints commands as they are executed.
590 // For more about build flags, see 'go help build'.
592 // For more about specifying packages, see 'go help packages'.
595 // Add dependencies to current module and install them
599 // go get [-d] [-t] [-u] [-v] [-insecure] [build flags] [packages]
601 // Get resolves its command-line arguments to packages at specific module versions,
602 // updates go.mod to require those versions, downloads source code into the
603 // module cache, then builds and installs the named packages.
605 // To add a dependency for a package or upgrade it to its latest version:
607 // go get example.com/pkg
609 // To upgrade or downgrade a package to a specific version:
611 // go get example.com/pkg@v1.2.3
613 // To remove a dependency on a module and downgrade modules that require it:
615 // go get example.com/mod@none
617 // See https://golang.org/ref/mod#go-get for details.
619 // The 'go install' command may be used to build and install packages. When a
620 // version is specified, 'go install' runs in module-aware mode and ignores
621 // the go.mod file in the current directory. For example:
623 // go install example.com/pkg@v1.2.3
624 // go install example.com/pkg@latest
626 // See 'go help install' or https://golang.org/ref/mod#go-install for details.
628 // In addition to build flags (listed in 'go help build') 'go get' accepts the
631 // The -t flag instructs get to consider modules needed to build tests of
632 // packages specified on the command line.
634 // The -u flag instructs get to update modules providing dependencies
635 // of packages named on the command line to use newer minor or patch
636 // releases when available.
638 // The -u=patch flag (not -u patch) also instructs get to update dependencies,
639 // but changes the default to select patch releases.
641 // When the -t and -u flags are used together, get will update
642 // test dependencies as well.
644 // The -insecure flag permits fetching from repositories and resolving
645 // custom domains using insecure schemes such as HTTP, and also bypassess
646 // module sum validation using the checksum database. Use with caution.
647 // This flag is deprecated and will be removed in a future version of go.
648 // To permit the use of insecure schemes, use the GOINSECURE environment
649 // variable instead. To bypass module sum validation, use GOPRIVATE or
650 // GONOSUMDB. See 'go help environment' for details.
652 // The -d flag instructs get not to build or install packages. get will only
653 // update go.mod and download source code needed to build packages.
655 // Building and installing packages with get is deprecated. In a future release,
656 // the -d flag will be enabled by default, and 'go get' will be only be used to
657 // adjust dependencies of the current module. To install a package using
658 // dependencies from the current module, use 'go install'. To install a package
659 // ignoring the current module, use 'go install' with an @version suffix like
660 // "@latest" after each argument.
662 // For more about modules, see https://golang.org/ref/mod.
664 // For more about specifying packages, see 'go help packages'.
666 // This text describes the behavior of get using modules to manage source
667 // code and dependencies. If instead the go command is running in GOPATH
668 // mode, the details of get's flags and effects change, as does 'go help get'.
669 // See 'go help gopath-get'.
671 // See also: go build, go install, go clean, go mod.
674 // Compile and install packages and dependencies
678 // go install [build flags] [packages]
680 // Install compiles and installs the packages named by the import paths.
682 // Executables are installed in the directory named by the GOBIN environment
683 // variable, which defaults to $GOPATH/bin or $HOME/go/bin if the GOPATH
684 // environment variable is not set. Executables in $GOROOT
685 // are installed in $GOROOT/bin or $GOTOOLDIR instead of $GOBIN.
687 // If the arguments have version suffixes (like @latest or @v1.0.0), "go install"
688 // builds packages in module-aware mode, ignoring the go.mod file in the current
689 // directory or any parent directory, if there is one. This is useful for
690 // installing executables without affecting the dependencies of the main module.
691 // To eliminate ambiguity about which module versions are used in the build, the
692 // arguments must satisfy the following constraints:
694 // - Arguments must be package paths or package patterns (with "..." wildcards).
695 // They must not be standard packages (like fmt), meta-patterns (std, cmd,
696 // all), or relative or absolute file paths.
697 // - All arguments must have the same version suffix. Different queries are not
698 // allowed, even if they refer to the same version.
699 // - All arguments must refer to packages in the same module at the same version.
700 // - No module is considered the "main" module. If the module containing
701 // packages named on the command line has a go.mod file, it must not contain
702 // directives (replace and exclude) that would cause it to be interpreted
703 // differently than if it were the main module. The module must not require
704 // a higher version of itself.
705 // - Package path arguments must refer to main packages. Pattern arguments
706 // will only match main packages.
708 // If the arguments don't have version suffixes, "go install" may run in
709 // module-aware mode or GOPATH mode, depending on the GO111MODULE environment
710 // variable and the presence of a go.mod file. See 'go help modules' for details.
711 // If module-aware mode is enabled, "go install" runs in the context of the main
714 // When module-aware mode is disabled, other packages are installed in the
715 // directory $GOPATH/pkg/$GOOS_$GOARCH. When module-aware mode is enabled,
716 // other packages are built and cached but not installed.
718 // The -i flag installs the dependencies of the named packages as well.
719 // The -i flag is deprecated. Compiled packages are cached automatically.
721 // For more about the build flags, see 'go help build'.
722 // For more about specifying packages, see 'go help packages'.
724 // See also: go build, go get, go clean.
727 // List packages or modules
731 // go list [-f format] [-json] [-m] [list flags] [build flags] [packages]
733 // List lists the named packages, one per line.
734 // The most commonly-used flags are -f and -json, which control the form
735 // of the output printed for each package. Other list flags, documented below,
736 // control more specific details.
738 // The default output shows the package import path:
742 // github.com/gorilla/mux
743 // golang.org/x/net/html
745 // The -f flag specifies an alternate format for the list, using the
746 // syntax of package template. The default output is equivalent
747 // to -f '{{.ImportPath}}'. The struct being passed to the template is:
749 // type Package struct {
750 // Dir string // directory containing package sources
751 // ImportPath string // import path of package in dir
752 // ImportComment string // path in import comment on package statement
753 // Name string // package name
754 // Doc string // package documentation string
755 // Target string // install path
756 // Shlib string // the shared library that contains this package (only set when -linkshared)
757 // Goroot bool // is this package in the Go root?
758 // Standard bool // is this package part of the standard Go library?
759 // Stale bool // would 'go install' do anything for this package?
760 // StaleReason string // explanation for Stale==true
761 // Root string // Go root or Go path dir containing this package
762 // ConflictDir string // this directory shadows Dir in $GOPATH
763 // BinaryOnly bool // binary-only package (no longer supported)
764 // ForTest string // package is only for use in named test
765 // Export string // file containing export data (when using -export)
766 // BuildID string // build ID of the compiled package (when using -export)
767 // Module *Module // info about package's containing module, if any (can be nil)
768 // Match []string // command-line patterns matching this package
769 // DepOnly bool // package is only a dependency, not explicitly listed
772 // GoFiles []string // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles)
773 // CgoFiles []string // .go source files that import "C"
774 // CompiledGoFiles []string // .go files presented to compiler (when using -compiled)
775 // IgnoredGoFiles []string // .go source files ignored due to build constraints
776 // IgnoredOtherFiles []string // non-.go source files ignored due to build constraints
777 // CFiles []string // .c source files
778 // CXXFiles []string // .cc, .cxx and .cpp source files
779 // MFiles []string // .m source files
780 // HFiles []string // .h, .hh, .hpp and .hxx source files
781 // FFiles []string // .f, .F, .for and .f90 Fortran source files
782 // SFiles []string // .s source files
783 // SwigFiles []string // .swig files
784 // SwigCXXFiles []string // .swigcxx files
785 // SysoFiles []string // .syso object files to add to archive
786 // TestGoFiles []string // _test.go files in package
787 // XTestGoFiles []string // _test.go files outside package
790 // EmbedPatterns []string // //go:embed patterns
791 // EmbedFiles []string // files matched by EmbedPatterns
792 // TestEmbedPatterns []string // //go:embed patterns in TestGoFiles
793 // TestEmbedFiles []string // files matched by TestEmbedPatterns
794 // XTestEmbedPatterns []string // //go:embed patterns in XTestGoFiles
795 // XTestEmbedFiles []string // files matched by XTestEmbedPatterns
798 // CgoCFLAGS []string // cgo: flags for C compiler
799 // CgoCPPFLAGS []string // cgo: flags for C preprocessor
800 // CgoCXXFLAGS []string // cgo: flags for C++ compiler
801 // CgoFFLAGS []string // cgo: flags for Fortran compiler
802 // CgoLDFLAGS []string // cgo: flags for linker
803 // CgoPkgConfig []string // cgo: pkg-config names
805 // // Dependency information
806 // Imports []string // import paths used by this package
807 // ImportMap map[string]string // map from source import to ImportPath (identity entries omitted)
808 // Deps []string // all (recursively) imported dependencies
809 // TestImports []string // imports from TestGoFiles
810 // XTestImports []string // imports from XTestGoFiles
812 // // Error information
813 // Incomplete bool // this package or a dependency has an error
814 // Error *PackageError // error loading package
815 // DepsErrors []*PackageError // errors loading dependencies
818 // Packages stored in vendor directories report an ImportPath that includes the
819 // path to the vendor directory (for example, "d/vendor/p" instead of "p"),
820 // so that the ImportPath uniquely identifies a given copy of a package.
821 // The Imports, Deps, TestImports, and XTestImports lists also contain these
822 // expanded import paths. See golang.org/s/go15vendor for more about vendoring.
824 // The error information, if any, is
826 // type PackageError struct {
827 // ImportStack []string // shortest path from package named on command line to this one
828 // Pos string // position of error (if present, file:line:col)
829 // Err string // the error itself
832 // The module information is a Module struct, defined in the discussion
835 // The template function "join" calls strings.Join.
837 // The template function "context" returns the build context, defined as:
839 // type Context struct {
840 // GOARCH string // target architecture
841 // GOOS string // target operating system
842 // GOROOT string // Go root
843 // GOPATH string // Go path
844 // CgoEnabled bool // whether cgo can be used
845 // UseAllFiles bool // use files regardless of +build lines, file names
846 // Compiler string // compiler to assume when computing target paths
847 // BuildTags []string // build constraints to match in +build lines
848 // ReleaseTags []string // releases the current release is compatible with
849 // InstallSuffix string // suffix to use in the name of the install dir
852 // For more information about the meaning of these fields see the documentation
853 // for the go/build package's Context type.
855 // The -json flag causes the package data to be printed in JSON format
856 // instead of using the template format.
858 // The -compiled flag causes list to set CompiledGoFiles to the Go source
859 // files presented to the compiler. Typically this means that it repeats
860 // the files listed in GoFiles and then also adds the Go code generated
861 // by processing CgoFiles and SwigFiles. The Imports list contains the
862 // union of all imports from both GoFiles and CompiledGoFiles.
864 // The -deps flag causes list to iterate over not just the named packages
865 // but also all their dependencies. It visits them in a depth-first post-order
866 // traversal, so that a package is listed only after all its dependencies.
867 // Packages not explicitly listed on the command line will have the DepOnly
868 // field set to true.
870 // The -e flag changes the handling of erroneous packages, those that
871 // cannot be found or are malformed. By default, the list command
872 // prints an error to standard error for each erroneous package and
873 // omits the packages from consideration during the usual printing.
874 // With the -e flag, the list command never prints errors to standard
875 // error and instead processes the erroneous packages with the usual
876 // printing. Erroneous packages will have a non-empty ImportPath and
877 // a non-nil Error field; other information may or may not be missing
880 // The -export flag causes list to set the Export field to the name of a
881 // file containing up-to-date export information for the given package.
883 // The -find flag causes list to identify the named packages but not
884 // resolve their dependencies: the Imports and Deps lists will be empty.
886 // The -test flag causes list to report not only the named packages
887 // but also their test binaries (for packages with tests), to convey to
888 // source code analysis tools exactly how test binaries are constructed.
889 // The reported import path for a test binary is the import path of
890 // the package followed by a ".test" suffix, as in "math/rand.test".
891 // When building a test, it is sometimes necessary to rebuild certain
892 // dependencies specially for that test (most commonly the tested
893 // package itself). The reported import path of a package recompiled
894 // for a particular test binary is followed by a space and the name of
895 // the test binary in brackets, as in "math/rand [math/rand.test]"
896 // or "regexp [sort.test]". The ForTest field is also set to the name
897 // of the package being tested ("math/rand" or "sort" in the previous
900 // The Dir, Target, Shlib, Root, ConflictDir, and Export file paths
901 // are all absolute paths.
903 // By default, the lists GoFiles, CgoFiles, and so on hold names of files in Dir
904 // (that is, paths relative to Dir, not absolute paths).
905 // The generated files added when using the -compiled and -test flags
906 // are absolute paths referring to cached copies of generated Go source files.
907 // Although they are Go source files, the paths may not end in ".go".
909 // The -m flag causes list to list modules instead of packages.
911 // When listing modules, the -f flag still specifies a format template
912 // applied to a Go struct, but now a Module struct:
914 // type Module struct {
915 // Path string // module path
916 // Version string // module version
917 // Versions []string // available module versions (with -versions)
918 // Replace *Module // replaced by this module
919 // Time *time.Time // time version was created
920 // Update *Module // available update, if any (with -u)
921 // Main bool // is this the main module?
922 // Indirect bool // is this module only an indirect dependency of main module?
923 // Dir string // directory holding files for this module, if any
924 // GoMod string // path to go.mod file used when loading this module, if any
925 // GoVersion string // go version used in module
926 // Retracted string // retraction information, if any (with -retracted or -u)
927 // Error *ModuleError // error loading module
930 // type ModuleError struct {
931 // Err string // the error itself
934 // The file GoMod refers to may be outside the module directory if the
935 // module is in the module cache or if the -modfile flag is used.
937 // The default output is to print the module path and then
938 // information about the version and replacement if any.
939 // For example, 'go list -m all' might print:
942 // golang.org/x/text v0.3.0 => /tmp/text
945 // The Module struct has a String method that formats this
946 // line of output, so that the default format is equivalent
947 // to -f '{{.String}}'.
949 // Note that when a module has been replaced, its Replace field
950 // describes the replacement module, and its Dir field is set to
951 // the replacement's source code, if present. (That is, if Replace
952 // is non-nil, then Dir is set to Replace.Dir, with no access to
953 // the replaced source code.)
955 // The -u flag adds information about available upgrades.
956 // When the latest version of a given module is newer than
957 // the current one, list -u sets the Module's Update field
958 // to information about the newer module. list -u will also set
959 // the module's Retracted field if the current version is retracted.
960 // The Module's String method indicates an available upgrade by
961 // formatting the newer version in brackets after the current version.
962 // If a version is retracted, the string "(retracted)" will follow it.
963 // For example, 'go list -m -u all' might print:
966 // golang.org/x/text v0.3.0 [v0.4.0] => /tmp/text
967 // rsc.io/pdf v0.1.1 (retracted) [v0.1.2]
969 // (For tools, 'go list -m -u -json all' may be more convenient to parse.)
971 // The -versions flag causes list to set the Module's Versions field
972 // to a list of all known versions of that module, ordered according
973 // to semantic versioning, earliest to latest. The flag also changes
974 // the default output format to display the module path followed by the
975 // space-separated version list.
977 // The -retracted flag causes list to report information about retracted
978 // module versions. When -retracted is used with -f or -json, the Retracted
979 // field will be set to a string explaining why the version was retracted.
980 // The string is taken from comments on the retract directive in the
981 // module's go.mod file. When -retracted is used with -versions, retracted
982 // versions are listed together with unretracted versions. The -retracted
983 // flag may be used with or without -m.
985 // The arguments to list -m are interpreted as a list of modules, not packages.
986 // The main module is the module containing the current directory.
987 // The active modules are the main module and its dependencies.
988 // With no arguments, list -m shows the main module.
989 // With arguments, list -m shows the modules specified by the arguments.
990 // Any of the active modules can be specified by its module path.
991 // The special pattern "all" specifies all the active modules, first the main
992 // module and then dependencies sorted by module path.
993 // A pattern containing "..." specifies the active modules whose
994 // module paths match the pattern.
995 // A query of the form path@version specifies the result of that query,
996 // which is not limited to active modules.
997 // See 'go help modules' for more about module queries.
999 // The template function "module" takes a single string argument
1000 // that must be a module path or query and returns the specified
1001 // module as a Module struct. If an error occurs, the result will
1002 // be a Module struct with a non-nil Error field.
1004 // For more about build flags, see 'go help build'.
1006 // For more about specifying packages, see 'go help packages'.
1008 // For more about modules, see https://golang.org/ref/mod.
1011 // Module maintenance
1013 // Go mod provides access to operations on modules.
1015 // Note that support for modules is built into all the go commands,
1016 // not just 'go mod'. For example, day-to-day adding, removing, upgrading,
1017 // and downgrading of dependencies should be done using 'go get'.
1018 // See 'go help modules' for an overview of module functionality.
1022 // go mod <command> [arguments]
1024 // The commands are:
1026 // download download modules to local cache
1027 // edit edit go.mod from tools or scripts
1028 // graph print module requirement graph
1029 // init initialize new module in current directory
1030 // tidy add missing and remove unused modules
1031 // vendor make vendored copy of dependencies
1032 // verify verify dependencies have expected content
1033 // why explain why packages or modules are needed
1035 // Use "go help mod <command>" for more information about a command.
1037 // Download modules to local cache
1041 // go mod download [-x] [-json] [modules]
1043 // Download downloads the named modules, which can be module patterns selecting
1044 // dependencies of the main module or module queries of the form path@version.
1045 // With no arguments, download applies to all dependencies of the main module
1046 // (equivalent to 'go mod download all').
1048 // The go command will automatically download modules as needed during ordinary
1049 // execution. The "go mod download" command is useful mainly for pre-filling
1050 // the local cache or to compute the answers for a Go module proxy.
1052 // By default, download writes nothing to standard output. It may print progress
1053 // messages and errors to standard error.
1055 // The -json flag causes download to print a sequence of JSON objects
1056 // to standard output, describing each downloaded module (or failure),
1057 // corresponding to this Go struct:
1059 // type Module struct {
1060 // Path string // module path
1061 // Version string // module version
1062 // Error string // error loading module
1063 // Info string // absolute path to cached .info file
1064 // GoMod string // absolute path to cached .mod file
1065 // Zip string // absolute path to cached .zip file
1066 // Dir string // absolute path to cached source root directory
1067 // Sum string // checksum for path, version (as in go.sum)
1068 // GoModSum string // checksum for go.mod (as in go.sum)
1071 // The -x flag causes download to print the commands download executes.
1073 // See https://golang.org/ref/mod#go-mod-download for more about 'go mod download'.
1075 // See https://golang.org/ref/mod#version-queries for more about version queries.
1078 // Edit go.mod from tools or scripts
1082 // go mod edit [editing flags] [go.mod]
1084 // Edit provides a command-line interface for editing go.mod,
1085 // for use primarily by tools or scripts. It reads only go.mod;
1086 // it does not look up information about the modules involved.
1087 // By default, edit reads and writes the go.mod file of the main module,
1088 // but a different target file can be specified after the editing flags.
1090 // The editing flags specify a sequence of editing operations.
1092 // The -fmt flag reformats the go.mod file without making other changes.
1093 // This reformatting is also implied by any other modifications that use or
1094 // rewrite the go.mod file. The only time this flag is needed is if no other
1095 // flags are specified, as in 'go mod edit -fmt'.
1097 // The -module flag changes the module's path (the go.mod file's module line).
1099 // The -require=path@version and -droprequire=path flags
1100 // add and drop a requirement on the given module path and version.
1101 // Note that -require overrides any existing requirements on path.
1102 // These flags are mainly for tools that understand the module graph.
1103 // Users should prefer 'go get path@version' or 'go get path@none',
1104 // which make other go.mod adjustments as needed to satisfy
1105 // constraints imposed by other modules.
1107 // The -exclude=path@version and -dropexclude=path@version flags
1108 // add and drop an exclusion for the given module path and version.
1109 // Note that -exclude=path@version is a no-op if that exclusion already exists.
1111 // The -replace=old[@v]=new[@v] flag adds a replacement of the given
1112 // module path and version pair. If the @v in old@v is omitted, a
1113 // replacement without a version on the left side is added, which applies
1114 // to all versions of the old module path. If the @v in new@v is omitted,
1115 // the new path should be a local module root directory, not a module
1116 // path. Note that -replace overrides any redundant replacements for old[@v],
1117 // so omitting @v will drop existing replacements for specific versions.
1119 // The -dropreplace=old[@v] flag drops a replacement of the given
1120 // module path and version pair. If the @v is omitted, a replacement without
1121 // a version on the left side is dropped.
1123 // The -retract=version and -dropretract=version flags add and drop a
1124 // retraction on the given version. The version may be a single version
1125 // like "v1.2.3" or a closed interval like "[v1.1.0,v1.1.9]". Note that
1126 // -retract=version is a no-op if that retraction already exists.
1128 // The -require, -droprequire, -exclude, -dropexclude, -replace,
1129 // -dropreplace, -retract, and -dropretract editing flags may be repeated,
1130 // and the changes are applied in the order given.
1132 // The -go=version flag sets the expected Go language version.
1134 // The -print flag prints the final go.mod in its text format instead of
1135 // writing it back to go.mod.
1137 // The -json flag prints the final go.mod file in JSON format instead of
1138 // writing it back to go.mod. The JSON output corresponds to these Go types:
1140 // type Module struct {
1145 // type GoMod struct {
1148 // Require []Require
1150 // Replace []Replace
1151 // Retract []Retract
1154 // type Require struct {
1160 // type Replace struct {
1165 // type Retract struct {
1171 // Retract entries representing a single version (not an interval) will have
1172 // the "Low" and "High" fields set to the same value.
1174 // Note that this only describes the go.mod file itself, not other modules
1175 // referred to indirectly. For the full set of modules available to a build,
1176 // use 'go list -m -json all'.
1178 // See https://golang.org/ref/mod#go-mod-edit for more about 'go mod edit'.
1181 // Print module requirement graph
1187 // Graph prints the module requirement graph (with replacements applied)
1188 // in text form. Each line in the output has two space-separated fields: a module
1189 // and one of its requirements. Each module is identified as a string of the form
1190 // path@version, except for the main module, which has no @version suffix.
1192 // See https://golang.org/ref/mod#go-mod-graph for more about 'go mod graph'.
1195 // Initialize new module in current directory
1199 // go mod init [module]
1201 // Init initializes and writes a new go.mod file in the current directory, in
1202 // effect creating a new module rooted at the current directory. The go.mod file
1203 // must not already exist.
1205 // Init accepts one optional argument, the module path for the new module. If the
1206 // module path argument is omitted, init will attempt to infer the module path
1207 // using import comments in .go files, vendoring tool configuration files (like
1208 // Gopkg.lock), and the current directory (if in GOPATH).
1210 // If a configuration file for a vendoring tool is present, init will attempt to
1211 // import module requirements from it.
1213 // See https://golang.org/ref/mod#go-mod-init for more about 'go mod init'.
1216 // Add missing and remove unused modules
1220 // go mod tidy [-e] [-v]
1222 // Tidy makes sure go.mod matches the source code in the module.
1223 // It adds any missing modules necessary to build the current module's
1224 // packages and dependencies, and it removes unused modules that
1225 // don't provide any relevant packages. It also adds any missing entries
1226 // to go.sum and removes any unnecessary ones.
1228 // The -v flag causes tidy to print information about removed modules
1229 // to standard error.
1231 // The -e flag causes tidy to attempt to proceed despite errors
1232 // encountered while loading packages.
1234 // See https://golang.org/ref/mod#go-mod-tidy for more about 'go mod tidy'.
1237 // Make vendored copy of dependencies
1241 // go mod vendor [-e] [-v]
1243 // Vendor resets the main module's vendor directory to include all packages
1244 // needed to build and test all the main module's packages.
1245 // It does not include test code for vendored packages.
1247 // The -v flag causes vendor to print the names of vendored
1248 // modules and packages to standard error.
1250 // The -e flag causes vendor to attempt to proceed despite errors
1251 // encountered while loading packages.
1253 // See https://golang.org/ref/mod#go-mod-vendor for more about 'go mod vendor'.
1256 // Verify dependencies have expected content
1262 // Verify checks that the dependencies of the current module,
1263 // which are stored in a local downloaded source cache, have not been
1264 // modified since being downloaded. If all the modules are unmodified,
1265 // verify prints "all modules verified." Otherwise it reports which
1266 // modules have been changed and causes 'go mod' to exit with a
1269 // See https://golang.org/ref/mod#go-mod-verify for more about 'go mod verify'.
1272 // Explain why packages or modules are needed
1276 // go mod why [-m] [-vendor] packages...
1278 // Why shows a shortest path in the import graph from the main module to
1279 // each of the listed packages. If the -m flag is given, why treats the
1280 // arguments as a list of modules and finds a path to any package in each
1283 // By default, why queries the graph of packages matched by "go list all",
1284 // which includes tests for reachable packages. The -vendor flag causes why
1285 // to exclude tests of dependencies.
1287 // The output is a sequence of stanzas, one for each package or module
1288 // name on the command line, separated by blank lines. Each stanza begins
1289 // with a comment line "# package" or "# module" giving the target
1290 // package or module. Subsequent lines give a path through the import
1291 // graph, one package per line. If the package or module is not
1292 // referenced from the main module, the stanza will display a single
1293 // parenthesized note indicating that fact.
1297 // $ go mod why golang.org/x/text/language golang.org/x/text/encoding
1298 // # golang.org/x/text/language
1301 // golang.org/x/text/language
1303 // # golang.org/x/text/encoding
1304 // (main module does not need package golang.org/x/text/encoding)
1307 // See https://golang.org/ref/mod#go-mod-why for more about 'go mod why'.
1310 // Compile and run Go program
1314 // go run [build flags] [-exec xprog] package [arguments...]
1316 // Run compiles and runs the named main Go package.
1317 // Typically the package is specified as a list of .go source files from a single directory,
1318 // but it may also be an import path, file system path, or pattern
1319 // matching a single known package, as in 'go run .' or 'go run my/cmd'.
1321 // By default, 'go run' runs the compiled binary directly: 'a.out arguments...'.
1322 // If the -exec flag is given, 'go run' invokes the binary using xprog:
1323 // 'xprog a.out arguments...'.
1324 // If the -exec flag is not given, GOOS or GOARCH is different from the system
1325 // default, and a program named go_$GOOS_$GOARCH_exec can be found
1326 // on the current search path, 'go run' invokes the binary using that program,
1327 // for example 'go_js_wasm_exec a.out arguments...'. This allows execution of
1328 // cross-compiled programs when a simulator or other execution method is
1331 // The exit status of Run is not the exit status of the compiled binary.
1333 // For more about build flags, see 'go help build'.
1334 // For more about specifying packages, see 'go help packages'.
1336 // See also: go build.
1343 // go test [build/test flags] [packages] [build/test flags & test binary flags]
1345 // 'Go test' automates testing the packages named by the import paths.
1346 // It prints a summary of the test results in the format:
1348 // ok archive/tar 0.011s
1349 // FAIL archive/zip 0.022s
1350 // ok compress/gzip 0.033s
1353 // followed by detailed output for each failed package.
1355 // 'Go test' recompiles each package along with any files with names matching
1356 // the file pattern "*_test.go".
1357 // These additional files can contain test functions, benchmark functions, and
1358 // example functions. See 'go help testfunc' for more.
1359 // Each listed package causes the execution of a separate test binary.
1360 // Files whose names begin with "_" (including "_test.go") or "." are ignored.
1362 // Test files that declare a package with the suffix "_test" will be compiled as a
1363 // separate package, and then linked and run with the main test binary.
1365 // The go tool will ignore a directory named "testdata", making it available
1366 // to hold ancillary data needed by the tests.
1368 // As part of building a test binary, go test runs go vet on the package
1369 // and its test source files to identify significant problems. If go vet
1370 // finds any problems, go test reports those and does not run the test
1371 // binary. Only a high-confidence subset of the default go vet checks are
1372 // used. That subset is: 'atomic', 'bool', 'buildtags', 'errorsas',
1373 // 'ifaceassert', 'nilfunc', 'printf', and 'stringintconv'. You can see
1374 // the documentation for these and other vet tests via "go doc cmd/vet".
1375 // To disable the running of go vet, use the -vet=off flag.
1377 // All test output and summary lines are printed to the go command's
1378 // standard output, even if the test printed them to its own standard
1379 // error. (The go command's standard error is reserved for printing
1380 // errors building the tests.)
1382 // Go test runs in two different modes:
1384 // The first, called local directory mode, occurs when go test is
1385 // invoked with no package arguments (for example, 'go test' or 'go
1386 // test -v'). In this mode, go test compiles the package sources and
1387 // tests found in the current directory and then runs the resulting
1388 // test binary. In this mode, caching (discussed below) is disabled.
1389 // After the package test finishes, go test prints a summary line
1390 // showing the test status ('ok' or 'FAIL'), package name, and elapsed
1393 // The second, called package list mode, occurs when go test is invoked
1394 // with explicit package arguments (for example 'go test math', 'go
1395 // test ./...', and even 'go test .'). In this mode, go test compiles
1396 // and tests each of the packages listed on the command line. If a
1397 // package test passes, go test prints only the final 'ok' summary
1398 // line. If a package test fails, go test prints the full test output.
1399 // If invoked with the -bench or -v flag, go test prints the full
1400 // output even for passing package tests, in order to display the
1401 // requested benchmark results or verbose logging. After the package
1402 // tests for all of the listed packages finish, and their output is
1403 // printed, go test prints a final 'FAIL' status if any package test
1406 // In package list mode only, go test caches successful package test
1407 // results to avoid unnecessary repeated running of tests. When the
1408 // result of a test can be recovered from the cache, go test will
1409 // redisplay the previous output instead of running the test binary
1410 // again. When this happens, go test prints '(cached)' in place of the
1411 // elapsed time in the summary line.
1413 // The rule for a match in the cache is that the run involves the same
1414 // test binary and the flags on the command line come entirely from a
1415 // restricted set of 'cacheable' test flags, defined as -cpu, -list,
1416 // -parallel, -run, -short, and -v. If a run of go test has any test
1417 // or non-test flags outside this set, the result is not cached. To
1418 // disable test caching, use any test flag or argument other than the
1419 // cacheable flags. The idiomatic way to disable test caching explicitly
1420 // is to use -count=1. Tests that open files within the package's source
1421 // root (usually $GOPATH) or that consult environment variables only
1422 // match future runs in which the files and environment variables are unchanged.
1423 // A cached test result is treated as executing in no time at all,
1424 // so a successful package test result will be cached and reused
1425 // regardless of -timeout setting.
1427 // In addition to the build flags, the flags handled by 'go test' itself are:
1430 // Pass the remainder of the command line (everything after -args)
1431 // to the test binary, uninterpreted and unchanged.
1432 // Because this flag consumes the remainder of the command line,
1433 // the package list (if present) must appear before this flag.
1436 // Compile the test binary to pkg.test but do not run it
1437 // (where pkg is the last element of the package's import path).
1438 // The file name can be changed with the -o flag.
1441 // Run the test binary using xprog. The behavior is the same as
1442 // in 'go run'. See 'go help run' for details.
1445 // Install packages that are dependencies of the test.
1446 // Do not run the test.
1447 // The -i flag is deprecated. Compiled packages are cached automatically.
1450 // Convert test output to JSON suitable for automated processing.
1451 // See 'go doc test2json' for the encoding details.
1454 // Compile the test binary to the named file.
1455 // The test still runs (unless -c or -i is specified).
1457 // The test binary also accepts flags that control execution of the test; these
1458 // flags are also accessible by 'go test'. See 'go help testflag' for details.
1460 // For more about build flags, see 'go help build'.
1461 // For more about specifying packages, see 'go help packages'.
1463 // See also: go build, go vet.
1466 // Run specified go tool
1470 // go tool [-n] command [args...]
1472 // Tool runs the go tool command identified by the arguments.
1473 // With no arguments it prints the list of known tools.
1475 // The -n flag causes tool to print the command that would be
1476 // executed but not execute it.
1478 // For more about each tool command, see 'go doc cmd/<command>'.
1485 // go version [-m] [-v] [file ...]
1487 // Version prints the build information for Go executables.
1489 // Go version reports the Go version used to build each of the named
1490 // executable files.
1492 // If no files are named on the command line, go version prints its own
1493 // version information.
1495 // If a directory is named, go version walks that directory, recursively,
1496 // looking for recognized Go binaries and reporting their versions.
1497 // By default, go version does not report unrecognized files found
1498 // during a directory scan. The -v flag causes it to report unrecognized files.
1500 // The -m flag causes go version to print each executable's embedded
1501 // module version information, when available. In the output, the module
1502 // information consists of multiple lines following the version line, each
1503 // indented by a leading tab character.
1505 // See also: go doc runtime/debug.BuildInfo.
1508 // Report likely mistakes in packages
1512 // go vet [-n] [-x] [-vettool prog] [build flags] [vet flags] [packages]
1514 // Vet runs the Go vet command on the packages named by the import paths.
1516 // For more about vet and its flags, see 'go doc cmd/vet'.
1517 // For more about specifying packages, see 'go help packages'.
1518 // For a list of checkers and their flags, see 'go tool vet help'.
1519 // For details of a specific checker such as 'printf', see 'go tool vet help printf'.
1521 // The -n flag prints commands that would be executed.
1522 // The -x flag prints commands as they are executed.
1524 // The -vettool=prog flag selects a different analysis tool with alternative
1525 // or additional checks.
1526 // For example, the 'shadow' analyzer can be built and run using these commands:
1528 // go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
1529 // go vet -vettool=$(which shadow)
1531 // The build flags supported by go vet are those that control package resolution
1532 // and execution, such as -n, -x, -v, -tags, and -toolexec.
1533 // For more about these flags, see 'go help build'.
1535 // See also: go fmt, go fix.
1538 // Build constraints
1540 // A build constraint, also known as a build tag, is a line comment that begins
1544 // that lists the conditions under which a file should be included in the package.
1545 // Constraints may appear in any kind of source file (not just Go), but
1546 // they must appear near the top of the file, preceded
1547 // only by blank lines and other line comments. These rules mean that in Go
1548 // files a build constraint must appear before the package clause.
1550 // To distinguish build constraints from package documentation, a series of
1551 // build constraints must be followed by a blank line.
1553 // A build constraint is evaluated as the OR of space-separated options.
1554 // Each option evaluates as the AND of its comma-separated terms.
1555 // Each term consists of letters, digits, underscores, and dots.
1556 // A term may be negated with a preceding !.
1557 // For example, the build constraint:
1559 // // +build linux,386 darwin,!cgo
1561 // corresponds to the boolean formula:
1563 // (linux AND 386) OR (darwin AND (NOT cgo))
1565 // A file may have multiple build constraints. The overall constraint is the AND
1566 // of the individual constraints. That is, the build constraints:
1568 // // +build linux darwin
1571 // corresponds to the boolean formula:
1573 // (linux OR darwin) AND amd64
1575 // During a particular build, the following words are satisfied:
1577 // - the target operating system, as spelled by runtime.GOOS, set with the
1578 // GOOS environment variable.
1579 // - the target architecture, as spelled by runtime.GOARCH, set with the
1580 // GOARCH environment variable.
1581 // - the compiler being used, either "gc" or "gccgo"
1582 // - "cgo", if the cgo command is supported (see CGO_ENABLED in
1583 // 'go help environment').
1584 // - a term for each Go major release, through the current version:
1585 // "go1.1" from Go version 1.1 onward, "go1.12" from Go 1.12, and so on.
1586 // - any additional tags given by the -tags flag (see 'go help build').
1588 // There are no separate build tags for beta or minor releases.
1590 // If a file's name, after stripping the extension and a possible _test suffix,
1591 // matches any of the following patterns:
1595 // (example: source_windows_amd64.go) where GOOS and GOARCH represent
1596 // any known operating system and architecture values respectively, then
1597 // the file is considered to have an implicit build constraint requiring
1598 // those terms (in addition to any explicit constraints in the file).
1600 // Using GOOS=android matches build tags and files as for GOOS=linux
1601 // in addition to android tags and files.
1603 // Using GOOS=illumos matches build tags and files as for GOOS=solaris
1604 // in addition to illumos tags and files.
1606 // Using GOOS=ios matches build tags and files as for GOOS=darwin
1607 // in addition to ios tags and files.
1609 // To keep a file from being considered for the build:
1613 // (any other unsatisfied word will work as well, but "ignore" is conventional.)
1615 // To build a file only when using cgo, and only on Linux and OS X:
1617 // // +build linux,cgo darwin,cgo
1619 // Such a file is usually paired with another file implementing the
1620 // default functionality for other systems, which in this case would
1621 // carry the constraint:
1623 // // +build !linux,!darwin !cgo
1625 // Naming a file dns_windows.go will cause it to be included only when
1626 // building the package for Windows; similarly, math_386.s will be included
1627 // only when building the package for 32-bit x86.
1632 // The 'go build' and 'go install' commands take a -buildmode argument which
1633 // indicates which kind of object file is to be built. Currently supported values
1636 // -buildmode=archive
1637 // Build the listed non-main packages into .a files. Packages named
1638 // main are ignored.
1640 // -buildmode=c-archive
1641 // Build the listed main package, plus all packages it imports,
1642 // into a C archive file. The only callable symbols will be those
1643 // functions exported using a cgo //export comment. Requires
1644 // exactly one main package to be listed.
1646 // -buildmode=c-shared
1647 // Build the listed main package, plus all packages it imports,
1648 // into a C shared library. The only callable symbols will
1649 // be those functions exported using a cgo //export comment.
1650 // Requires exactly one main package to be listed.
1652 // -buildmode=default
1653 // Listed main packages are built into executables and listed
1654 // non-main packages are built into .a files (the default
1657 // -buildmode=shared
1658 // Combine all the listed non-main packages into a single shared
1659 // library that will be used when building with the -linkshared
1660 // option. Packages named main are ignored.
1663 // Build the listed main packages and everything they import into
1664 // executables. Packages not named main are ignored.
1667 // Build the listed main packages and everything they import into
1668 // position independent executables (PIE). Packages not named
1669 // main are ignored.
1671 // -buildmode=plugin
1672 // Build the listed main packages, plus all packages that they
1673 // import, into a Go plugin. Packages not named main are ignored.
1675 // On AIX, when linking a C program that uses a Go archive built with
1676 // -buildmode=c-archive, you must pass -Wl,-bnoobjreorder to the C compiler.
1679 // Calling between Go and C
1681 // There are two different ways to call between Go and C/C++ code.
1683 // The first is the cgo tool, which is part of the Go distribution. For
1684 // information on how to use it see the cgo documentation (go doc cmd/cgo).
1686 // The second is the SWIG program, which is a general tool for
1687 // interfacing between languages. For information on SWIG see
1688 // http://swig.org/. When running go build, any file with a .swig
1689 // extension will be passed to SWIG. Any file with a .swigcxx extension
1690 // will be passed to SWIG with the -c++ option.
1692 // When either cgo or SWIG is used, go build will pass any .c, .m, .s, .S
1693 // or .sx files to the C compiler, and any .cc, .cpp, .cxx files to the C++
1694 // compiler. The CC or CXX environment variables may be set to determine
1695 // the C or C++ compiler, respectively, to use.
1698 // Build and test caching
1700 // The go command caches build outputs for reuse in future builds.
1701 // The default location for cache data is a subdirectory named go-build
1702 // in the standard user cache directory for the current operating system.
1703 // Setting the GOCACHE environment variable overrides this default,
1704 // and running 'go env GOCACHE' prints the current cache directory.
1706 // The go command periodically deletes cached data that has not been
1707 // used recently. Running 'go clean -cache' deletes all cached data.
1709 // The build cache correctly accounts for changes to Go source files,
1710 // compilers, compiler options, and so on: cleaning the cache explicitly
1711 // should not be necessary in typical use. However, the build cache
1712 // does not detect changes to C libraries imported with cgo.
1713 // If you have made changes to the C libraries on your system, you
1714 // will need to clean the cache explicitly or else use the -a build flag
1715 // (see 'go help build') to force rebuilding of packages that
1716 // depend on the updated C libraries.
1718 // The go command also caches successful package test results.
1719 // See 'go help test' for details. Running 'go clean -testcache' removes
1720 // all cached test results (but not cached build results).
1722 // The GODEBUG environment variable can enable printing of debugging
1723 // information about the state of the cache:
1725 // GODEBUG=gocacheverify=1 causes the go command to bypass the
1726 // use of any cache entries and instead rebuild everything and check
1727 // that the results match existing cache entries.
1729 // GODEBUG=gocachehash=1 causes the go command to print the inputs
1730 // for all of the content hashes it uses to construct cache lookup keys.
1731 // The output is voluminous but can be useful for debugging the cache.
1733 // GODEBUG=gocachetest=1 causes the go command to print details of its
1734 // decisions about whether to reuse a cached test result.
1737 // Environment variables
1739 // The go command and the tools it invokes consult environment variables
1740 // for configuration. If an environment variable is unset, the go command
1741 // uses a sensible default setting. To see the effective setting of the
1742 // variable <NAME>, run 'go env <NAME>'. To change the default setting,
1743 // run 'go env -w <NAME>=<VALUE>'. Defaults changed using 'go env -w'
1744 // are recorded in a Go environment configuration file stored in the
1745 // per-user configuration directory, as reported by os.UserConfigDir.
1746 // The location of the configuration file can be changed by setting
1747 // the environment variable GOENV, and 'go env GOENV' prints the
1748 // effective location, but 'go env -w' cannot change the default location.
1749 // See 'go help env' for details.
1751 // General-purpose environment variables:
1754 // Controls whether the go command runs in module-aware mode or GOPATH mode.
1755 // May be "off", "on", or "auto".
1756 // See https://golang.org/ref/mod#mod-commands.
1758 // The gccgo command to run for 'go build -compiler=gccgo'.
1760 // The architecture, or processor, for which to compile code.
1761 // Examples are amd64, 386, arm, ppc64.
1763 // The directory where 'go install' will install a command.
1765 // The directory where the go command will store cached
1766 // information for reuse in future builds.
1768 // The directory where the go command will store downloaded modules.
1770 // Enable various debugging facilities. See 'go doc runtime'
1773 // The location of the Go environment configuration file.
1774 // Cannot be set using 'go env -w'.
1776 // A space-separated list of -flag=value settings to apply
1777 // to go commands by default, when the given flag is known by
1778 // the current command. Each entry must be a standalone flag.
1779 // Because the entries are space-separated, flag values must
1780 // not contain spaces. Flags listed on the command line
1781 // are applied after this list and therefore override it.
1783 // Comma-separated list of glob patterns (in the syntax of Go's path.Match)
1784 // of module path prefixes that should always be fetched in an insecure
1785 // manner. Only applies to dependencies that are being fetched directly.
1786 // Unlike the -insecure flag on 'go get', GOINSECURE does not disable
1787 // checksum database validation. GOPRIVATE or GONOSUMDB may be used
1790 // The operating system for which to compile code.
1791 // Examples are linux, darwin, windows, netbsd.
1793 // For more details see: 'go help gopath'.
1795 // URL of Go module proxy. See https://golang.org/ref/mod#environment-variables
1796 // and https://golang.org/ref/mod#module-proxy for details.
1797 // GOPRIVATE, GONOPROXY, GONOSUMDB
1798 // Comma-separated list of glob patterns (in the syntax of Go's path.Match)
1799 // of module path prefixes that should always be fetched directly
1800 // or that should not be compared against the checksum database.
1801 // See https://golang.org/ref/mod#private-modules.
1803 // The root of the go tree.
1805 // The name of checksum database to use and optionally its public key and
1806 // URL. See https://golang.org/ref/mod#authenticating.
1808 // The directory where the go command will write
1809 // temporary source files, packages, and binaries.
1811 // Lists version control commands that may be used with matching servers.
1812 // See 'go help vcs'.
1814 // Environment variables for use with cgo:
1817 // The command to use to manipulate library archives when
1818 // building with the gccgo compiler.
1819 // The default is 'ar'.
1821 // The command to use to compile C code.
1823 // Whether the cgo command is supported. Either 0 or 1.
1825 // Flags that cgo will pass to the compiler when compiling
1828 // A regular expression specifying additional flags to allow
1829 // to appear in #cgo CFLAGS source code directives.
1830 // Does not apply to the CGO_CFLAGS environment variable.
1831 // CGO_CFLAGS_DISALLOW
1832 // A regular expression specifying flags that must be disallowed
1833 // from appearing in #cgo CFLAGS source code directives.
1834 // Does not apply to the CGO_CFLAGS environment variable.
1835 // CGO_CPPFLAGS, CGO_CPPFLAGS_ALLOW, CGO_CPPFLAGS_DISALLOW
1836 // Like CGO_CFLAGS, CGO_CFLAGS_ALLOW, and CGO_CFLAGS_DISALLOW,
1837 // but for the C preprocessor.
1838 // CGO_CXXFLAGS, CGO_CXXFLAGS_ALLOW, CGO_CXXFLAGS_DISALLOW
1839 // Like CGO_CFLAGS, CGO_CFLAGS_ALLOW, and CGO_CFLAGS_DISALLOW,
1840 // but for the C++ compiler.
1841 // CGO_FFLAGS, CGO_FFLAGS_ALLOW, CGO_FFLAGS_DISALLOW
1842 // Like CGO_CFLAGS, CGO_CFLAGS_ALLOW, and CGO_CFLAGS_DISALLOW,
1843 // but for the Fortran compiler.
1844 // CGO_LDFLAGS, CGO_LDFLAGS_ALLOW, CGO_LDFLAGS_DISALLOW
1845 // Like CGO_CFLAGS, CGO_CFLAGS_ALLOW, and CGO_CFLAGS_DISALLOW,
1846 // but for the linker.
1848 // The command to use to compile C++ code.
1850 // The command to use to compile Fortran code.
1852 // Path to pkg-config tool.
1854 // Architecture-specific environment variables:
1857 // For GOARCH=arm, the ARM architecture for which to compile.
1858 // Valid values are 5, 6, 7.
1860 // For GOARCH=386, how to implement floating point instructions.
1861 // Valid values are sse2 (default), softfloat.
1863 // For GOARCH=mips{,le}, whether to use floating point instructions.
1864 // Valid values are hardfloat (default), softfloat.
1866 // For GOARCH=mips64{,le}, whether to use floating point instructions.
1867 // Valid values are hardfloat (default), softfloat.
1869 // For GOARCH=wasm, comma-separated list of experimental WebAssembly features to use.
1870 // Valid values are satconv, signext.
1872 // Special-purpose environment variables:
1875 // If set, where to find gccgo tools, such as cgo.
1876 // The default is based on how gccgo was configured.
1878 // The root of the installed Go tree, when it is
1879 // installed in a location other than where it is built.
1880 // File names in stack traces are rewritten from GOROOT to
1882 // GO_EXTLINK_ENABLED
1883 // Whether the linker should use external linking mode
1884 // when using -linkmode=auto with code that uses cgo.
1885 // Set to 0 to disable external linking mode, 1 to enable it.
1886 // GIT_ALLOW_PROTOCOL
1887 // Defined by Git. A colon-separated list of schemes that are allowed
1888 // to be used with git fetch/clone. If set, any scheme not explicitly
1889 // mentioned will be considered insecure by 'go get'.
1890 // Because the variable is defined by Git, the default value cannot
1891 // be set using 'go env -w'.
1893 // Additional information available from 'go env' but not read from the environment:
1896 // The executable file name suffix (".exe" on Windows, "" on other systems).
1898 // A space-separated list of arguments supplied to the CC command.
1900 // The architecture (GOARCH) of the Go toolchain binaries.
1902 // The operating system (GOOS) of the Go toolchain binaries.
1904 // The absolute path to the go.mod of the main module.
1905 // If module-aware mode is enabled, but there is no go.mod, GOMOD will be
1906 // os.DevNull ("/dev/null" on Unix-like systems, "NUL" on Windows).
1907 // If module-aware mode is disabled, GOMOD will be the empty string.
1909 // The directory where the go tools (compile, cover, doc, etc...) are installed.
1911 // The version of the installed Go tree, as reported by runtime.Version.
1916 // The go command examines the contents of a restricted set of files
1917 // in each directory. It identifies which files to examine based on
1918 // the extension of the file name. These extensions are:
1924 // If the package uses cgo or SWIG, these will be compiled with the
1925 // OS-native compiler (typically gcc); otherwise they will
1926 // trigger an error.
1927 // .cc, .cpp, .cxx, .hh, .hpp, .hxx
1928 // C++ source files. Only useful with cgo or SWIG, and always
1929 // compiled with the OS-native compiler.
1931 // Objective-C source files. Only useful with cgo, and always
1932 // compiled with the OS-native compiler.
1934 // Assembler source files.
1935 // If the package uses cgo or SWIG, these will be assembled with the
1936 // OS-native assembler (typically gcc (sic)); otherwise they
1937 // will be assembled with the Go assembler.
1939 // SWIG definition files.
1941 // System object files.
1943 // Files of each of these types except .syso may contain build
1944 // constraints, but the go command stops scanning for build constraints
1945 // at the first item in the file that is not a blank line or //-style
1946 // line comment. See the go/build package documentation for
1952 // A module version is defined by a tree of source files, with a go.mod
1953 // file in its root. When the go command is run, it looks in the current
1954 // directory and then successive parent directories to find the go.mod
1955 // marking the root of the main (current) module.
1957 // The go.mod file format is described in detail at
1958 // https://golang.org/ref/mod#go-mod-file.
1960 // To create a new go.mod file, use 'go help init'. For details see
1961 // 'go help mod init' or https://golang.org/ref/mod#go-mod-init.
1963 // To add missing module requirements or remove unneeded requirements,
1964 // use 'go mod tidy'. For details, see 'go help mod tidy' or
1965 // https://golang.org/ref/mod#go-mod-tidy.
1967 // To add, upgrade, downgrade, or remove a specific module requirement, use
1968 // 'go get'. For details, see 'go help module-get' or
1969 // https://golang.org/ref/mod#go-get.
1971 // To make other changes or to parse go.mod as JSON for use by other tools,
1972 // use 'go mod edit'. See 'go help mod edit' or
1973 // https://golang.org/ref/mod#go-mod-edit.
1976 // GOPATH environment variable
1978 // The Go path is used to resolve import statements.
1979 // It is implemented by and documented in the go/build package.
1981 // The GOPATH environment variable lists places to look for Go code.
1982 // On Unix, the value is a colon-separated string.
1983 // On Windows, the value is a semicolon-separated string.
1984 // On Plan 9, the value is a list.
1986 // If the environment variable is unset, GOPATH defaults
1987 // to a subdirectory named "go" in the user's home directory
1988 // ($HOME/go on Unix, %USERPROFILE%\go on Windows),
1989 // unless that directory holds a Go distribution.
1990 // Run "go env GOPATH" to see the current GOPATH.
1992 // See https://golang.org/wiki/SettingGOPATH to set a custom GOPATH.
1994 // Each directory listed in GOPATH must have a prescribed structure:
1996 // The src directory holds source code. The path below src
1997 // determines the import path or executable name.
1999 // The pkg directory holds installed package objects.
2000 // As in the Go tree, each target operating system and
2001 // architecture pair has its own subdirectory of pkg
2002 // (pkg/GOOS_GOARCH).
2004 // If DIR is a directory listed in the GOPATH, a package with
2005 // source in DIR/src/foo/bar can be imported as "foo/bar" and
2006 // has its compiled form installed to "DIR/pkg/GOOS_GOARCH/foo/bar.a".
2008 // The bin directory holds compiled commands.
2009 // Each command is named for its source directory, but only
2010 // the final element, not the entire path. That is, the
2011 // command with source in DIR/src/foo/quux is installed into
2012 // DIR/bin/quux, not DIR/bin/foo/quux. The "foo/" prefix is stripped
2013 // so that you can add DIR/bin to your PATH to get at the
2014 // installed commands. If the GOBIN environment variable is
2015 // set, commands are installed to the directory it names instead
2016 // of DIR/bin. GOBIN must be an absolute path.
2018 // Here's an example directory layout:
2020 // GOPATH=/home/user/go
2025 // bar/ (go code in package bar)
2027 // quux/ (go code in package main)
2030 // quux (installed command)
2034 // bar.a (installed package object)
2036 // Go searches each directory listed in GOPATH to find source code,
2037 // but new packages are always downloaded into the first directory
2040 // See https://golang.org/doc/code.html for an example.
2042 // GOPATH and Modules
2044 // When using modules, GOPATH is no longer used for resolving imports.
2045 // However, it is still used to store downloaded source code (in GOPATH/pkg/mod)
2046 // and compiled commands (in GOPATH/bin).
2048 // Internal Directories
2050 // Code in or below a directory named "internal" is importable only
2051 // by code in the directory tree rooted at the parent of "internal".
2052 // Here's an extended version of the directory layout above:
2057 // bang/ (go code in package bang)
2059 // foo/ (go code in package foo)
2061 // bar/ (go code in package bar)
2064 // baz/ (go code in package baz)
2066 // quux/ (go code in package main)
2070 // The code in z.go is imported as "foo/internal/baz", but that
2071 // import statement can only appear in source files in the subtree
2072 // rooted at foo. The source files foo/f.go, foo/bar/x.go, and
2073 // foo/quux/y.go can all import "foo/internal/baz", but the source file
2074 // crash/bang/b.go cannot.
2076 // See https://golang.org/s/go14internal for details.
2078 // Vendor Directories
2080 // Go 1.6 includes support for using local copies of external dependencies
2081 // to satisfy imports of those dependencies, often referred to as vendoring.
2083 // Code below a directory named "vendor" is importable only
2084 // by code in the directory tree rooted at the parent of "vendor",
2085 // and only using an import path that omits the prefix up to and
2086 // including the vendor element.
2088 // Here's the example from the previous section,
2089 // but with the "internal" directory renamed to "vendor"
2090 // and a new foo/vendor/crash/bang directory added:
2095 // bang/ (go code in package bang)
2097 // foo/ (go code in package foo)
2099 // bar/ (go code in package bar)
2103 // bang/ (go code in package bang)
2105 // baz/ (go code in package baz)
2107 // quux/ (go code in package main)
2110 // The same visibility rules apply as for internal, but the code
2111 // in z.go is imported as "baz", not as "foo/vendor/baz".
2113 // Code in vendor directories deeper in the source tree shadows
2114 // code in higher directories. Within the subtree rooted at foo, an import
2115 // of "crash/bang" resolves to "foo/vendor/crash/bang", not the
2116 // top-level "crash/bang".
2118 // Code in vendor directories is not subject to import path
2119 // checking (see 'go help importpath').
2121 // When 'go get' checks out or updates a git repository, it now also
2122 // updates submodules.
2124 // Vendor directories do not affect the placement of new repositories
2125 // being checked out for the first time by 'go get': those are always
2126 // placed in the main GOPATH, never in a vendor subtree.
2128 // See https://golang.org/s/go15vendor for details.
2131 // Legacy GOPATH go get
2133 // The 'go get' command changes behavior depending on whether the
2134 // go command is running in module-aware mode or legacy GOPATH mode.
2135 // This help text, accessible as 'go help gopath-get' even in module-aware mode,
2136 // describes 'go get' as it operates in legacy GOPATH mode.
2138 // Usage: go get [-d] [-f] [-t] [-u] [-v] [-fix] [-insecure] [build flags] [packages]
2140 // Get downloads the packages named by the import paths, along with their
2141 // dependencies. It then installs the named packages, like 'go install'.
2143 // The -d flag instructs get to stop after downloading the packages; that is,
2144 // it instructs get not to install the packages.
2146 // The -f flag, valid only when -u is set, forces get -u not to verify that
2147 // each package has been checked out from the source control repository
2148 // implied by its import path. This can be useful if the source is a local fork
2151 // The -fix flag instructs get to run the fix tool on the downloaded packages
2152 // before resolving dependencies or building the code.
2154 // The -insecure flag permits fetching from repositories and resolving
2155 // custom domains using insecure schemes such as HTTP. Use with caution.
2156 // This flag is deprecated and will be removed in a future version of go.
2157 // The GOINSECURE environment variable should be used instead, since it
2158 // provides control over which packages may be retrieved using an insecure
2159 // scheme. See 'go help environment' for details.
2161 // The -t flag instructs get to also download the packages required to build
2162 // the tests for the specified packages.
2164 // The -u flag instructs get to use the network to update the named packages
2165 // and their dependencies. By default, get uses the network to check out
2166 // missing packages but does not use it to look for updates to existing packages.
2168 // The -v flag enables verbose progress and debug output.
2170 // Get also accepts build flags to control the installation. See 'go help build'.
2172 // When checking out a new package, get creates the target directory
2173 // GOPATH/src/<import-path>. If the GOPATH contains multiple entries,
2174 // get uses the first one. For more details see: 'go help gopath'.
2176 // When checking out or updating a package, get looks for a branch or tag
2177 // that matches the locally installed version of Go. The most important
2178 // rule is that if the local installation is running version "go1", get
2179 // searches for a branch or tag named "go1". If no such version exists
2180 // it retrieves the default branch of the package.
2182 // When go get checks out or updates a Git repository,
2183 // it also updates any git submodules referenced by the repository.
2185 // Get never checks out or updates code stored in vendor directories.
2187 // For more about specifying packages, see 'go help packages'.
2189 // For more about how 'go get' finds source code to
2190 // download, see 'go help importpath'.
2192 // This text describes the behavior of get when using GOPATH
2193 // to manage source code and dependencies.
2194 // If instead the go command is running in module-aware mode,
2195 // the details of get's flags and effects change, as does 'go help get'.
2196 // See 'go help modules' and 'go help module-get'.
2198 // See also: go build, go install, go clean.
2201 // Module proxy protocol
2203 // A Go module proxy is any web server that can respond to GET requests for
2204 // URLs of a specified form. The requests have no query parameters, so even
2205 // a site serving from a fixed file system (including a file:/// URL)
2206 // can be a module proxy.
2208 // For details on the GOPROXY protocol, see
2209 // https://golang.org/ref/mod#goproxy-protocol.
2212 // Import path syntax
2214 // An import path (see 'go help packages') denotes a package stored in the local
2215 // file system. In general, an import path denotes either a standard package (such
2216 // as "unicode/utf8") or a package found in one of the work spaces (For more
2217 // details see: 'go help gopath').
2219 // Relative import paths
2221 // An import path beginning with ./ or ../ is called a relative path.
2222 // The toolchain supports relative import paths as a shortcut in two ways.
2224 // First, a relative path can be used as a shorthand on the command line.
2225 // If you are working in the directory containing the code imported as
2226 // "unicode" and want to run the tests for "unicode/utf8", you can type
2227 // "go test ./utf8" instead of needing to specify the full path.
2228 // Similarly, in the reverse situation, "go test .." will test "unicode" from
2229 // the "unicode/utf8" directory. Relative patterns are also allowed, like
2230 // "go test ./..." to test all subdirectories. See 'go help packages' for details
2231 // on the pattern syntax.
2233 // Second, if you are compiling a Go program not in a work space,
2234 // you can use a relative path in an import statement in that program
2235 // to refer to nearby code also not in a work space.
2236 // This makes it easy to experiment with small multipackage programs
2237 // outside of the usual work spaces, but such programs cannot be
2238 // installed with "go install" (there is no work space in which to install them),
2239 // so they are rebuilt from scratch each time they are built.
2240 // To avoid ambiguity, Go programs cannot use relative import paths
2241 // within a work space.
2243 // Remote import paths
2245 // Certain import paths also
2246 // describe how to obtain the source code for the package using
2247 // a revision control system.
2249 // A few common code hosting sites have special syntax:
2251 // Bitbucket (Git, Mercurial)
2253 // import "bitbucket.org/user/project"
2254 // import "bitbucket.org/user/project/sub/directory"
2258 // import "github.com/user/project"
2259 // import "github.com/user/project/sub/directory"
2261 // Launchpad (Bazaar)
2263 // import "launchpad.net/project"
2264 // import "launchpad.net/project/series"
2265 // import "launchpad.net/project/series/sub/directory"
2267 // import "launchpad.net/~user/project/branch"
2268 // import "launchpad.net/~user/project/branch/sub/directory"
2270 // IBM DevOps Services (Git)
2272 // import "hub.jazz.net/git/user/project"
2273 // import "hub.jazz.net/git/user/project/sub/directory"
2275 // For code hosted on other servers, import paths may either be qualified
2276 // with the version control type, or the go tool can dynamically fetch
2277 // the import path over https/http and discover where the code resides
2278 // from a <meta> tag in the HTML.
2280 // To declare the code location, an import path of the form
2282 // repository.vcs/path
2284 // specifies the given repository, with or without the .vcs suffix,
2285 // using the named version control system, and then the path inside
2286 // that repository. The supported version control systems are:
2296 // import "example.org/user/foo.hg"
2298 // denotes the root directory of the Mercurial repository at
2299 // example.org/user/foo or foo.hg, and
2301 // import "example.org/repo.git/foo/bar"
2303 // denotes the foo/bar directory of the Git repository at
2304 // example.org/repo or repo.git.
2306 // When a version control system supports multiple protocols,
2307 // each is tried in turn when downloading. For example, a Git
2308 // download tries https://, then git+ssh://.
2310 // By default, downloads are restricted to known secure protocols
2311 // (e.g. https, ssh). To override this setting for Git downloads, the
2312 // GIT_ALLOW_PROTOCOL environment variable can be set (For more details see:
2313 // 'go help environment').
2315 // If the import path is not a known code hosting site and also lacks a
2316 // version control qualifier, the go tool attempts to fetch the import
2317 // over https/http and looks for a <meta> tag in the document's HTML
2320 // The meta tag has the form:
2322 // <meta name="go-import" content="import-prefix vcs repo-root">
2324 // The import-prefix is the import path corresponding to the repository
2325 // root. It must be a prefix or an exact match of the package being
2326 // fetched with "go get". If it's not an exact match, another http
2327 // request is made at the prefix to verify the <meta> tags match.
2329 // The meta tag should appear as early in the file as possible.
2330 // In particular, it should appear before any raw JavaScript or CSS,
2331 // to avoid confusing the go command's restricted parser.
2333 // The vcs is one of "bzr", "fossil", "git", "hg", "svn".
2335 // The repo-root is the root of the version control system
2336 // containing a scheme and not containing a .vcs qualifier.
2340 // import "example.org/pkg/foo"
2342 // will result in the following requests:
2344 // https://example.org/pkg/foo?go-get=1 (preferred)
2345 // http://example.org/pkg/foo?go-get=1 (fallback, only with -insecure)
2347 // If that page contains the meta tag
2349 // <meta name="go-import" content="example.org git https://code.org/r/p/exproj">
2351 // the go tool will verify that https://example.org/?go-get=1 contains the
2352 // same meta tag and then git clone https://code.org/r/p/exproj into
2353 // GOPATH/src/example.org.
2355 // When using GOPATH, downloaded packages are written to the first directory
2356 // listed in the GOPATH environment variable.
2357 // (See 'go help gopath-get' and 'go help gopath'.)
2359 // When using modules, downloaded packages are stored in the module cache.
2360 // See https://golang.org/ref/mod#module-cache.
2362 // When using modules, an additional variant of the go-import meta tag is
2363 // recognized and is preferred over those listing version control systems.
2364 // That variant uses "mod" as the vcs in the content value, as in:
2366 // <meta name="go-import" content="example.org mod https://code.org/moduleproxy">
2368 // This tag means to fetch modules with paths beginning with example.org
2369 // from the module proxy available at the URL https://code.org/moduleproxy.
2370 // See https://golang.org/ref/mod#goproxy-protocol for details about the
2373 // Import path checking
2375 // When the custom import path feature described above redirects to a
2376 // known code hosting site, each of the resulting packages has two possible
2377 // import paths, using the custom domain or the known hosting site.
2379 // A package statement is said to have an "import comment" if it is immediately
2380 // followed (before the next newline) by a comment of one of these two forms:
2382 // package math // import "path"
2383 // package math /* import "path" */
2385 // The go command will refuse to install a package with an import comment
2386 // unless it is being referred to by that import path. In this way, import comments
2387 // let package authors make sure the custom import path is used and not a
2388 // direct path to the underlying code hosting site.
2390 // Import path checking is disabled for code found within vendor trees.
2391 // This makes it possible to copy code into alternate locations in vendor trees
2392 // without needing to update import comments.
2394 // Import path checking is also disabled when using modules.
2395 // Import path comments are obsoleted by the go.mod file's module statement.
2397 // See https://golang.org/s/go14customimport for details.
2400 // Modules, module versions, and more
2402 // Modules are how Go manages dependencies.
2404 // A module is a collection of packages that are released, versioned, and
2405 // distributed together. Modules may be downloaded directly from version control
2406 // repositories or from module proxy servers.
2408 // For a series of tutorials on modules, see
2409 // https://golang.org/doc/tutorial/create-module.
2411 // For a detailed reference on modules, see https://golang.org/ref/mod.
2413 // By default, the go command may download modules from https://proxy.golang.org.
2414 // It may authenticate modules using the checksum database at
2415 // https://sum.golang.org. Both services are operated by the Go team at Google.
2416 // The privacy policies for these services are available at
2417 // https://proxy.golang.org/privacy and https://sum.golang.org/privacy,
2420 // The go command's download behavior may be configured using GOPROXY, GOSUMDB,
2421 // GOPRIVATE, and other environment variables. See 'go help environment'
2422 // and https://golang.org/ref/mod#private-module-privacy for more information.
2425 // Module authentication using go.sum
2427 // When the go command downloads a module zip file or go.mod file into the
2428 // module cache, it computes a cryptographic hash and compares it with a known
2429 // value to verify the file hasn't changed since it was first downloaded. Known
2430 // hashes are stored in a file in the module root directory named go.sum. Hashes
2431 // may also be downloaded from the checksum database depending on the values of
2432 // GOSUMDB, GOPRIVATE, and GONOSUMDB.
2434 // For details, see https://golang.org/ref/mod#authenticating.
2437 // Package lists and patterns
2439 // Many commands apply to a set of packages:
2441 // go action [packages]
2443 // Usually, [packages] is a list of import paths.
2445 // An import path that is a rooted path or that begins with
2446 // a . or .. element is interpreted as a file system path and
2447 // denotes the package in that directory.
2449 // Otherwise, the import path P denotes the package found in
2450 // the directory DIR/src/P for some DIR listed in the GOPATH
2451 // environment variable (For more details see: 'go help gopath').
2453 // If no import paths are given, the action applies to the
2454 // package in the current directory.
2456 // There are four reserved names for paths that should not be used
2457 // for packages to be built with the go tool:
2459 // - "main" denotes the top-level package in a stand-alone executable.
2461 // - "all" expands to all packages found in all the GOPATH
2462 // trees. For example, 'go list all' lists all the packages on the local
2463 // system. When using modules, "all" expands to all packages in
2464 // the main module and their dependencies, including dependencies
2465 // needed by tests of any of those.
2467 // - "std" is like all but expands to just the packages in the standard
2470 // - "cmd" expands to the Go repository's commands and their
2471 // internal libraries.
2473 // Import paths beginning with "cmd/" only match source code in
2474 // the Go repository.
2476 // An import path is a pattern if it includes one or more "..." wildcards,
2477 // each of which can match any string, including the empty string and
2478 // strings containing slashes. Such a pattern expands to all package
2479 // directories found in the GOPATH trees with names matching the
2482 // To make common patterns more convenient, there are two special cases.
2483 // First, /... at the end of the pattern can match an empty string,
2484 // so that net/... matches both net and packages in its subdirectories, like net/http.
2485 // Second, any slash-separated pattern element containing a wildcard never
2486 // participates in a match of the "vendor" element in the path of a vendored
2487 // package, so that ./... does not match packages in subdirectories of
2488 // ./vendor or ./mycode/vendor, but ./vendor/... and ./mycode/vendor/... do.
2489 // Note, however, that a directory named vendor that itself contains code
2490 // is not a vendored package: cmd/vendor would be a command named vendor,
2491 // and the pattern cmd/... matches it.
2492 // See golang.org/s/go15vendor for more about vendoring.
2494 // An import path can also name a package to be downloaded from
2495 // a remote repository. Run 'go help importpath' for details.
2497 // Every package in a program must have a unique import path.
2498 // By convention, this is arranged by starting each path with a
2499 // unique prefix that belongs to you. For example, paths used
2500 // internally at Google all begin with 'google', and paths
2501 // denoting remote repositories begin with the path to the code,
2502 // such as 'github.com/user/repo'.
2504 // Packages in a program need not have unique package names,
2505 // but there are two reserved package names with special meaning.
2506 // The name main indicates a command, not a library.
2507 // Commands are built into binaries and cannot be imported.
2508 // The name documentation indicates documentation for
2509 // a non-Go program in the directory. Files in package documentation
2510 // are ignored by the go command.
2512 // As a special case, if the package list is a list of .go files from a
2513 // single directory, the command is applied to a single synthesized
2514 // package made up of exactly those files, ignoring any build constraints
2515 // in those files and ignoring any other files in the directory.
2517 // Directory and file names that begin with "." or "_" are ignored
2518 // by the go tool, as are directories named "testdata".
2521 // Configuration for downloading non-public code
2523 // The go command defaults to downloading modules from the public Go module
2524 // mirror at proxy.golang.org. It also defaults to validating downloaded modules,
2525 // regardless of source, against the public Go checksum database at sum.golang.org.
2526 // These defaults work well for publicly available source code.
2528 // The GOPRIVATE environment variable controls which modules the go command
2529 // considers to be private (not available publicly) and should therefore not use
2530 // the proxy or checksum database. The variable is a comma-separated list of
2531 // glob patterns (in the syntax of Go's path.Match) of module path prefixes.
2534 // GOPRIVATE=*.corp.example.com,rsc.io/private
2536 // causes the go command to treat as private any module with a path prefix
2537 // matching either pattern, including git.corp.example.com/xyzzy, rsc.io/private,
2538 // and rsc.io/private/quux.
2540 // For fine-grained control over module download and validation, the GONOPROXY
2541 // and GONOSUMDB environment variables accept the same kind of glob list
2542 // and override GOPRIVATE for the specific decision of whether to use the proxy
2543 // and checksum database, respectively.
2545 // For example, if a company ran a module proxy serving private modules,
2546 // users would configure go using:
2548 // GOPRIVATE=*.corp.example.com
2549 // GOPROXY=proxy.example.com
2552 // The GOPRIVATE variable is also used to define the "public" and "private"
2553 // patterns for the GOVCS variable; see 'go help vcs'. For that usage,
2554 // GOPRIVATE applies even in GOPATH mode. In that case, it matches import paths
2555 // instead of module paths.
2557 // The 'go env -w' command (see 'go help env') can be used to set these variables
2558 // for future go command invocations.
2560 // For more details, see https://golang.org/ref/mod#private-modules.
2565 // The 'go test' command takes both flags that apply to 'go test' itself
2566 // and flags that apply to the resulting test binary.
2568 // Several of the flags control profiling and write an execution profile
2569 // suitable for "go tool pprof"; run "go tool pprof -h" for more
2570 // information. The --alloc_space, --alloc_objects, and --show_bytes
2571 // options of pprof control how the information is presented.
2573 // The following flags are recognized by the 'go test' command and
2574 // control the execution of any test:
2577 // Run only those benchmarks matching a regular expression.
2578 // By default, no benchmarks are run.
2579 // To run all benchmarks, use '-bench .' or '-bench=.'.
2580 // The regular expression is split by unbracketed slash (/)
2581 // characters into a sequence of regular expressions, and each
2582 // part of a benchmark's identifier must match the corresponding
2583 // element in the sequence, if any. Possible parents of matches
2584 // are run with b.N=1 to identify sub-benchmarks. For example,
2585 // given -bench=X/Y, top-level benchmarks matching X are run
2586 // with b.N=1 to find any sub-benchmarks matching Y, which are
2587 // then run in full.
2590 // Run enough iterations of each benchmark to take t, specified
2591 // as a time.Duration (for example, -benchtime 1h30s).
2592 // The default is 1 second (1s).
2593 // The special syntax Nx means to run the benchmark N times
2594 // (for example, -benchtime 100x).
2597 // Run each test and benchmark n times (default 1).
2598 // If -cpu is set, run n times for each GOMAXPROCS value.
2599 // Examples are always run once.
2602 // Enable coverage analysis.
2603 // Note that because coverage works by annotating the source
2604 // code before compilation, compilation and test failures with
2605 // coverage enabled may report line numbers that don't correspond
2606 // to the original sources.
2608 // -covermode set,count,atomic
2609 // Set the mode for coverage analysis for the package[s]
2610 // being tested. The default is "set" unless -race is enabled,
2611 // in which case it is "atomic".
2613 // set: bool: does this statement run?
2614 // count: int: how many times does this statement run?
2615 // atomic: int: count, but correct in multithreaded tests;
2616 // significantly more expensive.
2619 // -coverpkg pattern1,pattern2,pattern3
2620 // Apply coverage analysis in each test to packages matching the patterns.
2621 // The default is for each test to analyze only the package being tested.
2622 // See 'go help packages' for a description of package patterns.
2626 // Specify a list of GOMAXPROCS values for which the tests or
2627 // benchmarks should be executed. The default is the current value
2631 // Do not start new tests after the first test failure.
2634 // List tests, benchmarks, or examples matching the regular expression.
2635 // No tests, benchmarks or examples will be run. This will only
2636 // list top-level tests. No subtest or subbenchmarks will be shown.
2639 // Allow parallel execution of test functions that call t.Parallel.
2640 // The value of this flag is the maximum number of tests to run
2641 // simultaneously; by default, it is set to the value of GOMAXPROCS.
2642 // Note that -parallel only applies within a single test binary.
2643 // The 'go test' command may run tests for different packages
2644 // in parallel as well, according to the setting of the -p flag
2645 // (see 'go help build').
2648 // Run only those tests and examples matching the regular expression.
2649 // For tests, the regular expression is split by unbracketed slash (/)
2650 // characters into a sequence of regular expressions, and each part
2651 // of a test's identifier must match the corresponding element in
2652 // the sequence, if any. Note that possible parents of matches are
2653 // run too, so that -run=X/Y matches and runs and reports the result
2654 // of all tests matching X, even those without sub-tests matching Y,
2655 // because it must run them to look for those sub-tests.
2658 // Tell long-running tests to shorten their run time.
2659 // It is off by default but set during all.bash so that installing
2660 // the Go tree can run a sanity check but not spend time running
2661 // exhaustive tests.
2664 // If a test binary runs longer than duration d, panic.
2665 // If d is 0, the timeout is disabled.
2666 // The default is 10 minutes (10m).
2669 // Verbose output: log all tests as they are run. Also print all
2670 // text from Log and Logf calls even if the test succeeds.
2673 // Configure the invocation of "go vet" during "go test"
2674 // to use the comma-separated list of vet checks.
2675 // If list is empty, "go test" runs "go vet" with a curated list of
2676 // checks believed to be always worth addressing.
2677 // If list is "off", "go test" does not run "go vet" at all.
2679 // The following flags are also recognized by 'go test' and can be used to
2680 // profile the tests during execution:
2683 // Print memory allocation statistics for benchmarks.
2685 // -blockprofile block.out
2686 // Write a goroutine blocking profile to the specified file
2687 // when all tests are complete.
2688 // Writes test binary as -c would.
2690 // -blockprofilerate n
2691 // Control the detail provided in goroutine blocking profiles by
2692 // calling runtime.SetBlockProfileRate with n.
2693 // See 'go doc runtime.SetBlockProfileRate'.
2694 // The profiler aims to sample, on average, one blocking event every
2695 // n nanoseconds the program spends blocked. By default,
2696 // if -test.blockprofile is set without this flag, all blocking events
2697 // are recorded, equivalent to -test.blockprofilerate=1.
2699 // -coverprofile cover.out
2700 // Write a coverage profile to the file after all tests have passed.
2703 // -cpuprofile cpu.out
2704 // Write a CPU profile to the specified file before exiting.
2705 // Writes test binary as -c would.
2707 // -memprofile mem.out
2708 // Write an allocation profile to the file after all tests have passed.
2709 // Writes test binary as -c would.
2711 // -memprofilerate n
2712 // Enable more precise (and expensive) memory allocation profiles by
2713 // setting runtime.MemProfileRate. See 'go doc runtime.MemProfileRate'.
2714 // To profile all memory allocations, use -test.memprofilerate=1.
2716 // -mutexprofile mutex.out
2717 // Write a mutex contention profile to the specified file
2718 // when all tests are complete.
2719 // Writes test binary as -c would.
2721 // -mutexprofilefraction n
2722 // Sample 1 in n stack traces of goroutines holding a
2725 // -outputdir directory
2726 // Place output files from profiling in the specified directory,
2727 // by default the directory in which "go test" is running.
2730 // Write an execution trace to the specified file before exiting.
2732 // Each of these flags is also recognized with an optional 'test.' prefix,
2733 // as in -test.v. When invoking the generated test binary (the result of
2734 // 'go test -c') directly, however, the prefix is mandatory.
2736 // The 'go test' command rewrites or removes recognized flags,
2737 // as appropriate, both before and after the optional package list,
2738 // before invoking the test binary.
2740 // For instance, the command
2742 // go test -v -myflag testdata -cpuprofile=prof.out -x
2744 // will compile the test binary and then run it as
2746 // pkg.test -test.v -myflag testdata -test.cpuprofile=prof.out
2748 // (The -x flag is removed because it applies only to the go command's
2749 // execution, not to the test itself.)
2751 // The test flags that generate profiles (other than for coverage) also
2752 // leave the test binary in pkg.test for use when analyzing the profiles.
2754 // When 'go test' runs a test binary, it does so from within the
2755 // corresponding package's source code directory. Depending on the test,
2756 // it may be necessary to do the same when invoking a generated test
2759 // The command-line package list, if present, must appear before any
2760 // flag not known to the go test command. Continuing the example above,
2761 // the package list would have to appear before -myflag, but could appear
2762 // on either side of -v.
2764 // When 'go test' runs in package list mode, 'go test' caches successful
2765 // package test results to avoid unnecessary repeated running of tests. To
2766 // disable test caching, use any test flag or argument other than the
2767 // cacheable flags. The idiomatic way to disable test caching explicitly
2768 // is to use -count=1.
2770 // To keep an argument for a test binary from being interpreted as a
2771 // known flag or a package name, use -args (see 'go help test') which
2772 // passes the remainder of the command line through to the test binary
2773 // uninterpreted and unaltered.
2775 // For instance, the command
2777 // go test -v -args -x -v
2779 // will compile the test binary and then run it as
2781 // pkg.test -test.v -x -v
2785 // go test -args math
2787 // will compile the test binary and then run it as
2791 // In the first example, the -x and the second -v are passed through to the
2792 // test binary unchanged and with no effect on the go command itself.
2793 // In the second example, the argument math is passed through to the test
2794 // binary, instead of being interpreted as the package list.
2797 // Testing functions
2799 // The 'go test' command expects to find test, benchmark, and example functions
2800 // in the "*_test.go" files corresponding to the package under test.
2802 // A test function is one named TestXxx (where Xxx does not start with a
2803 // lower case letter) and should have the signature,
2805 // func TestXxx(t *testing.T) { ... }
2807 // A benchmark function is one named BenchmarkXxx and should have the signature,
2809 // func BenchmarkXxx(b *testing.B) { ... }
2811 // An example function is similar to a test function but, instead of using
2812 // *testing.T to report success or failure, prints output to os.Stdout.
2813 // If the last comment in the function starts with "Output:" then the output
2814 // is compared exactly against the comment (see examples below). If the last
2815 // comment begins with "Unordered output:" then the output is compared to the
2816 // comment, however the order of the lines is ignored. An example with no such
2817 // comment is compiled but not executed. An example with no text after
2818 // "Output:" is compiled, executed, and expected to produce no output.
2820 // Godoc displays the body of ExampleXxx to demonstrate the use
2821 // of the function, constant, or variable Xxx. An example of a method M with
2822 // receiver type T or *T is named ExampleT_M. There may be multiple examples
2823 // for a given function, constant, or variable, distinguished by a trailing _xxx,
2824 // where xxx is a suffix not beginning with an upper case letter.
2826 // Here is an example of an example:
2828 // func ExamplePrintln() {
2829 // Println("The output of\nthis example.")
2830 // // Output: The output of
2834 // Here is another example where the ordering of the output is ignored:
2836 // func ExamplePerm() {
2837 // for _, value := range Perm(4) {
2838 // fmt.Println(value)
2841 // // Unordered output: 4
2848 // The entire test file is presented as the example when it contains a single
2849 // example function, at least one other function, type, variable, or constant
2850 // declaration, and no test or benchmark functions.
2852 // See the documentation of the testing package for more information.
2855 // Controlling version control with GOVCS
2857 // The 'go get' command can run version control commands like git
2858 // to download imported code. This functionality is critical to the decentralized
2859 // Go package ecosystem, in which code can be imported from any server,
2860 // but it is also a potential security problem, if a malicious server finds a
2861 // way to cause the invoked version control command to run unintended code.
2863 // To balance the functionality and security concerns, the 'go get' command
2864 // by default will only use git and hg to download code from public servers.
2865 // But it will use any known version control system (bzr, fossil, git, hg, svn)
2866 // to download code from private servers, defined as those hosting packages
2867 // matching the GOPRIVATE variable (see 'go help private'). The rationale behind
2868 // allowing only Git and Mercurial is that these two systems have had the most
2869 // attention to issues of being run as clients of untrusted servers. In contrast,
2870 // Bazaar, Fossil, and Subversion have primarily been used in trusted,
2871 // authenticated environments and are not as well scrutinized as attack surfaces.
2873 // The version control command restrictions only apply when using direct version
2874 // control access to download code. When downloading modules from a proxy,
2875 // 'go get' uses the proxy protocol instead, which is always permitted.
2876 // By default, the 'go get' command uses the Go module mirror (proxy.golang.org)
2877 // for public packages and only falls back to version control for private
2878 // packages or when the mirror refuses to serve a public package (typically for
2879 // legal reasons). Therefore, clients can still access public code served from
2880 // Bazaar, Fossil, or Subversion repositories by default, because those downloads
2881 // use the Go module mirror, which takes on the security risk of running the
2882 // version control commands using a custom sandbox.
2884 // The GOVCS variable can be used to change the allowed version control systems
2885 // for specific packages (identified by a module or import path).
2886 // The GOVCS variable applies when building package in both module-aware mode
2887 // and GOPATH mode. When using modules, the patterns match against the module path.
2888 // When using GOPATH, the patterns match against the import path corresponding to
2889 // the root of the version control repository.
2891 // The general form of the GOVCS setting is a comma-separated list of
2892 // pattern:vcslist rules. The pattern is a glob pattern that must match
2893 // one or more leading elements of the module or import path. The vcslist
2894 // is a pipe-separated list of allowed version control commands, or "all"
2895 // to allow use of any known command, or "off" to disallow all commands.
2896 // Note that if a module matches a pattern with vcslist "off", it may still be
2897 // downloaded if the origin server uses the "mod" scheme, which instructs the
2898 // go command to download the module using the GOPROXY protocol.
2899 // The earliest matching pattern in the list applies, even if later patterns
2900 // might also match.
2902 // For example, consider:
2904 // GOVCS=github.com:git,evil.com:off,*:git|hg
2906 // With this setting, code with a module or import path beginning with
2907 // github.com/ can only use git; paths on evil.com cannot use any version
2908 // control command, and all other paths (* matches everything) can use
2911 // The special patterns "public" and "private" match public and private
2912 // module or import paths. A path is private if it matches the GOPRIVATE
2913 // variable; otherwise it is public.
2915 // If no rules in the GOVCS variable match a particular module or import path,
2916 // the 'go get' command applies its default rule, which can now be summarized
2917 // in GOVCS notation as 'public:git|hg,private:all'.
2919 // To allow unfettered use of any version control system for any package, use:
2923 // To disable all use of version control, use:
2927 // The 'go env -w' command (see 'go help env') can be used to set the GOVCS
2928 // variable for future go command invocations.