Source file src/cmd/go/alldocs.go
1 // Copyright 2011 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Code generated by mkalldocs.sh; DO NOT EDIT. 6 // Edit the documentation in other files and rerun mkalldocs.sh to generate this one. 7 8 // Go is a tool for managing Go source code. 9 // 10 // Usage: 11 // 12 // go <command> [arguments] 13 // 14 // The commands are: 15 // 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 // work workspace maintenance 29 // run compile and run Go program 30 // test test packages 31 // tool run specified go tool 32 // version print Go version 33 // vet report likely mistakes in packages 34 // 35 // Use "go help <command>" for more information about a command. 36 // 37 // Additional help topics: 38 // 39 // buildconstraint build constraints 40 // buildmode build modes 41 // c calling between Go and C 42 // cache build and test caching 43 // environment environment variables 44 // filetype file types 45 // go.mod the go.mod file 46 // gopath GOPATH environment variable 47 // gopath-get legacy GOPATH go get 48 // goproxy module proxy protocol 49 // importpath import path syntax 50 // modules modules, module versions, and more 51 // module-get module-aware go get 52 // module-auth module authentication using go.sum 53 // packages package lists and patterns 54 // private configuration for downloading non-public code 55 // testflag testing flags 56 // testfunc testing functions 57 // vcs controlling version control with GOVCS 58 // 59 // Use "go help <topic>" for more information about that topic. 60 // 61 // 62 // Start a bug report 63 // 64 // Usage: 65 // 66 // go bug 67 // 68 // Bug opens the default browser and starts a new bug report. 69 // The report includes useful system information. 70 // 71 // 72 // Compile packages and dependencies 73 // 74 // Usage: 75 // 76 // go build [-o output] [build flags] [packages] 77 // 78 // Build compiles the packages named by the import paths, 79 // along with their dependencies, but it does not install the results. 80 // 81 // If the arguments to build are a list of .go files from a single directory, 82 // build treats them as a list of source files specifying a single package. 83 // 84 // When compiling packages, build ignores files that end in '_test.go'. 85 // 86 // When compiling a single main package, build writes 87 // the resulting executable to an output file named after 88 // the first source file ('go build ed.go rx.go' writes 'ed' or 'ed.exe') 89 // or the source code directory ('go build unix/sam' writes 'sam' or 'sam.exe'). 90 // The '.exe' suffix is added when writing a Windows executable. 91 // 92 // When compiling multiple packages or a single non-main package, 93 // build compiles the packages but discards the resulting object, 94 // serving only as a check that the packages can be built. 95 // 96 // The -o flag forces build to write the resulting executable or object 97 // to the named output file or directory, instead of the default behavior described 98 // in the last two paragraphs. If the named output is an existing directory or 99 // ends with a slash or backslash, then any resulting executables 100 // will be written to that directory. 101 // 102 // The -i flag installs the packages that are dependencies of the target. 103 // The -i flag is deprecated. Compiled packages are cached automatically. 104 // 105 // The build flags are shared by the build, clean, get, install, list, run, 106 // and test commands: 107 // 108 // -a 109 // force rebuilding of packages that are already up-to-date. 110 // -n 111 // print the commands but do not run them. 112 // -p n 113 // the number of programs, such as build commands or 114 // test binaries, that can be run in parallel. 115 // The default is GOMAXPROCS, normally the number of CPUs available. 116 // -race 117 // enable data race detection. 118 // Supported only on linux/amd64, freebsd/amd64, darwin/amd64, darwin/arm64, windows/amd64, 119 // linux/ppc64le and linux/arm64 (only for 48-bit VMA). 120 // -msan 121 // enable interoperation with memory sanitizer. 122 // Supported only on linux/amd64, linux/arm64 123 // and only with Clang/LLVM as the host C compiler. 124 // On linux/arm64, pie build mode will be used. 125 // -asan 126 // enable interoperation with address sanitizer. 127 // Supported only on linux/arm64, linux/amd64. 128 // -v 129 // print the names of packages as they are compiled. 130 // -work 131 // print the name of the temporary work directory and 132 // do not delete it when exiting. 133 // -x 134 // print the commands. 135 // 136 // -asmflags '[pattern=]arg list' 137 // arguments to pass on each go tool asm invocation. 138 // -buildmode mode 139 // build mode to use. See 'go help buildmode' for more. 140 // -buildvcs 141 // Whether to stamp binaries with version control information 142 // ("true", "false", or "auto"). By default ("auto"), version control 143 // information is stamped into a binary if the main package, the main module 144 // containing it, and the current directory are all in the same repository. 145 // Use -buildvcs=false to always omit version control information, or 146 // -buildvcs=true to error out if version control information is available but 147 // cannot be included due to a missing tool or ambiguous directory structure. 148 // -compiler name 149 // name of compiler to use, as in runtime.Compiler (gccgo or gc). 150 // -gccgoflags '[pattern=]arg list' 151 // arguments to pass on each gccgo compiler/linker invocation. 152 // -gcflags '[pattern=]arg list' 153 // arguments to pass on each go tool compile invocation. 154 // -installsuffix suffix 155 // a suffix to use in the name of the package installation directory, 156 // in order to keep output separate from default builds. 157 // If using the -race flag, the install suffix is automatically set to race 158 // or, if set explicitly, has _race appended to it. Likewise for the -msan 159 // and -asan flags. Using a -buildmode option that requires non-default compile 160 // flags has a similar effect. 161 // -ldflags '[pattern=]arg list' 162 // arguments to pass on each go tool link invocation. 163 // -linkshared 164 // build code that will be linked against shared libraries previously 165 // created with -buildmode=shared. 166 // -mod mode 167 // module download mode to use: readonly, vendor, or mod. 168 // By default, if a vendor directory is present and the go version in go.mod 169 // is 1.14 or higher, the go command acts as if -mod=vendor were set. 170 // Otherwise, the go command acts as if -mod=readonly were set. 171 // See https://golang.org/ref/mod#build-commands for details. 172 // -modcacherw 173 // leave newly-created directories in the module cache read-write 174 // instead of making them read-only. 175 // -modfile file 176 // in module aware mode, read (and possibly write) an alternate go.mod 177 // file instead of the one in the module root directory. A file named 178 // "go.mod" must still be present in order to determine the module root 179 // directory, but it is not accessed. When -modfile is specified, an 180 // alternate go.sum file is also used: its path is derived from the 181 // -modfile flag by trimming the ".mod" extension and appending ".sum". 182 // -overlay file 183 // read a JSON config file that provides an overlay for build operations. 184 // The file is a JSON struct with a single field, named 'Replace', that 185 // maps each disk file path (a string) to its backing file path, so that 186 // a build will run as if the disk file path exists with the contents 187 // given by the backing file paths, or as if the disk file path does not 188 // exist if its backing file path is empty. Support for the -overlay flag 189 // has some limitations: importantly, cgo files included from outside the 190 // include path must be in the same directory as the Go package they are 191 // included from, and overlays will not appear when binaries and tests are 192 // run through go run and go test respectively. 193 // -pkgdir dir 194 // install and load all packages from dir instead of the usual locations. 195 // For example, when building with a non-standard configuration, 196 // use -pkgdir to keep generated packages in a separate location. 197 // -tags tag,list 198 // a comma-separated list of build tags to consider satisfied during the 199 // build. For more information about build tags, see the description of 200 // build constraints in the documentation for the go/build package. 201 // (Earlier versions of Go used a space-separated list, and that form 202 // is deprecated but still recognized.) 203 // -trimpath 204 // remove all file system paths from the resulting executable. 205 // Instead of absolute file system paths, the recorded file names 206 // will begin either a module path@version (when using modules), 207 // or a plain import path (when using the standard library, or GOPATH). 208 // -toolexec 'cmd args' 209 // a program to use to invoke toolchain programs like vet and asm. 210 // For example, instead of running asm, the go command will run 211 // 'cmd args /path/to/asm <arguments for asm>'. 212 // The TOOLEXEC_IMPORTPATH environment variable will be set, 213 // matching 'go list -f {{.ImportPath}}' for the package being built. 214 // 215 // The -asmflags, -gccgoflags, -gcflags, and -ldflags flags accept a 216 // space-separated list of arguments to pass to an underlying tool 217 // during the build. To embed spaces in an element in the list, surround 218 // it with either single or double quotes. The argument list may be 219 // preceded by a package pattern and an equal sign, which restricts 220 // the use of that argument list to the building of packages matching 221 // that pattern (see 'go help packages' for a description of package 222 // patterns). Without a pattern, the argument list applies only to the 223 // packages named on the command line. The flags may be repeated 224 // with different patterns in order to specify different arguments for 225 // different sets of packages. If a package matches patterns given in 226 // multiple flags, the latest match on the command line wins. 227 // For example, 'go build -gcflags=-S fmt' prints the disassembly 228 // only for package fmt, while 'go build -gcflags=all=-S fmt' 229 // prints the disassembly for fmt and all its dependencies. 230 // 231 // For more about specifying packages, see 'go help packages'. 232 // For more about where packages and binaries are installed, 233 // run 'go help gopath'. 234 // For more about calling between Go and C/C++, run 'go help c'. 235 // 236 // Note: Build adheres to certain conventions such as those described 237 // by 'go help gopath'. Not all projects can follow these conventions, 238 // however. Installations that have their own conventions or that use 239 // a separate software build system may choose to use lower-level 240 // invocations such as 'go tool compile' and 'go tool link' to avoid 241 // some of the overheads and design decisions of the build tool. 242 // 243 // See also: go install, go get, go clean. 244 // 245 // 246 // Remove object files and cached files 247 // 248 // Usage: 249 // 250 // go clean [clean flags] [build flags] [packages] 251 // 252 // Clean removes object files from package source directories. 253 // The go command builds most objects in a temporary directory, 254 // so go clean is mainly concerned with object files left by other 255 // tools or by manual invocations of go build. 256 // 257 // If a package argument is given or the -i or -r flag is set, 258 // clean removes the following files from each of the 259 // source directories corresponding to the import paths: 260 // 261 // _obj/ old object directory, left from Makefiles 262 // _test/ old test directory, left from Makefiles 263 // _testmain.go old gotest file, left from Makefiles 264 // test.out old test log, left from Makefiles 265 // build.out old test log, left from Makefiles 266 // *.[568ao] object files, left from Makefiles 267 // 268 // DIR(.exe) from go build 269 // DIR.test(.exe) from go test -c 270 // MAINFILE(.exe) from go build MAINFILE.go 271 // *.so from SWIG 272 // 273 // In the list, DIR represents the final path element of the 274 // directory, and MAINFILE is the base name of any Go source 275 // file in the directory that is not included when building 276 // the package. 277 // 278 // The -i flag causes clean to remove the corresponding installed 279 // archive or binary (what 'go install' would create). 280 // 281 // The -n flag causes clean to print the remove commands it would execute, 282 // but not run them. 283 // 284 // The -r flag causes clean to be applied recursively to all the 285 // dependencies of the packages named by the import paths. 286 // 287 // The -x flag causes clean to print remove commands as it executes them. 288 // 289 // The -cache flag causes clean to remove the entire go build cache. 290 // 291 // The -testcache flag causes clean to expire all test results in the 292 // go build cache. 293 // 294 // The -modcache flag causes clean to remove the entire module 295 // download cache, including unpacked source code of versioned 296 // dependencies. 297 // 298 // The -fuzzcache flag causes clean to remove files stored in the Go build 299 // cache for fuzz testing. The fuzzing engine caches files that expand 300 // code coverage, so removing them may make fuzzing less effective until 301 // new inputs are found that provide the same coverage. These files are 302 // distinct from those stored in testdata directory; clean does not remove 303 // those files. 304 // 305 // For more about build flags, see 'go help build'. 306 // 307 // For more about specifying packages, see 'go help packages'. 308 // 309 // 310 // Show documentation for package or symbol 311 // 312 // Usage: 313 // 314 // go doc [doc flags] [package|[package.]symbol[.methodOrField]] 315 // 316 // Doc prints the documentation comments associated with the item identified by its 317 // arguments (a package, const, func, type, var, method, or struct field) 318 // followed by a one-line summary of each of the first-level items "under" 319 // that item (package-level declarations for a package, methods for a type, 320 // etc.). 321 // 322 // Doc accepts zero, one, or two arguments. 323 // 324 // Given no arguments, that is, when run as 325 // 326 // go doc 327 // 328 // it prints the package documentation for the package in the current directory. 329 // If the package is a command (package main), the exported symbols of the package 330 // are elided from the presentation unless the -cmd flag is provided. 331 // 332 // When run with one argument, the argument is treated as a Go-syntax-like 333 // representation of the item to be documented. What the argument selects depends 334 // on what is installed in GOROOT and GOPATH, as well as the form of the argument, 335 // which is schematically one of these: 336 // 337 // go doc <pkg> 338 // go doc <sym>[.<methodOrField>] 339 // go doc [<pkg>.]<sym>[.<methodOrField>] 340 // go doc [<pkg>.][<sym>.]<methodOrField> 341 // 342 // The first item in this list matched by the argument is the one whose documentation 343 // is printed. (See the examples below.) However, if the argument starts with a capital 344 // letter it is assumed to identify a symbol or method in the current directory. 345 // 346 // For packages, the order of scanning is determined lexically in breadth-first order. 347 // That is, the package presented is the one that matches the search and is nearest 348 // the root and lexically first at its level of the hierarchy. The GOROOT tree is 349 // always scanned in its entirety before GOPATH. 350 // 351 // If there is no package specified or matched, the package in the current 352 // directory is selected, so "go doc Foo" shows the documentation for symbol Foo in 353 // the current package. 354 // 355 // The package path must be either a qualified path or a proper suffix of a 356 // path. The go tool's usual package mechanism does not apply: package path 357 // elements like . and ... are not implemented by go doc. 358 // 359 // When run with two arguments, the first is a package path (full path or suffix), 360 // and the second is a symbol, or symbol with method or struct field: 361 // 362 // go doc <pkg> <sym>[.<methodOrField>] 363 // 364 // In all forms, when matching symbols, lower-case letters in the argument match 365 // either case but upper-case letters match exactly. This means that there may be 366 // multiple matches of a lower-case argument in a package if different symbols have 367 // different cases. If this occurs, documentation for all matches is printed. 368 // 369 // Examples: 370 // go doc 371 // Show documentation for current package. 372 // go doc Foo 373 // Show documentation for Foo in the current package. 374 // (Foo starts with a capital letter so it cannot match 375 // a package path.) 376 // go doc encoding/json 377 // Show documentation for the encoding/json package. 378 // go doc json 379 // Shorthand for encoding/json. 380 // go doc json.Number (or go doc json.number) 381 // Show documentation and method summary for json.Number. 382 // go doc json.Number.Int64 (or go doc json.number.int64) 383 // Show documentation for json.Number's Int64 method. 384 // go doc cmd/doc 385 // Show package docs for the doc command. 386 // go doc -cmd cmd/doc 387 // Show package docs and exported symbols within the doc command. 388 // go doc template.new 389 // Show documentation for html/template's New function. 390 // (html/template is lexically before text/template) 391 // go doc text/template.new # One argument 392 // Show documentation for text/template's New function. 393 // go doc text/template new # Two arguments 394 // Show documentation for text/template's New function. 395 // 396 // At least in the current tree, these invocations all print the 397 // documentation for json.Decoder's Decode method: 398 // 399 // go doc json.Decoder.Decode 400 // go doc json.decoder.decode 401 // go doc json.decode 402 // cd go/src/encoding/json; go doc decode 403 // 404 // Flags: 405 // -all 406 // Show all the documentation for the package. 407 // -c 408 // Respect case when matching symbols. 409 // -cmd 410 // Treat a command (package main) like a regular package. 411 // Otherwise package main's exported symbols are hidden 412 // when showing the package's top-level documentation. 413 // -short 414 // One-line representation for each symbol. 415 // -src 416 // Show the full source code for the symbol. This will 417 // display the full Go source of its declaration and 418 // definition, such as a function definition (including 419 // the body), type declaration or enclosing const 420 // block. The output may therefore include unexported 421 // details. 422 // -u 423 // Show documentation for unexported as well as exported 424 // symbols, methods, and fields. 425 // 426 // 427 // Print Go environment information 428 // 429 // Usage: 430 // 431 // go env [-json] [-u] [-w] [var ...] 432 // 433 // Env prints Go environment information. 434 // 435 // By default env prints information as a shell script 436 // (on Windows, a batch file). If one or more variable 437 // names is given as arguments, env prints the value of 438 // each named variable on its own line. 439 // 440 // The -json flag prints the environment in JSON format 441 // instead of as a shell script. 442 // 443 // The -u flag requires one or more arguments and unsets 444 // the default setting for the named environment variables, 445 // if one has been set with 'go env -w'. 446 // 447 // The -w flag requires one or more arguments of the 448 // form NAME=VALUE and changes the default settings 449 // of the named environment variables to the given values. 450 // 451 // For more about environment variables, see 'go help environment'. 452 // 453 // 454 // Update packages to use new APIs 455 // 456 // Usage: 457 // 458 // go fix [-fix list] [packages] 459 // 460 // Fix runs the Go fix command on the packages named by the import paths. 461 // 462 // The -fix flag sets a comma-separated list of fixes to run. 463 // The default is all known fixes. 464 // (Its value is passed to 'go tool fix -r'.) 465 // 466 // For more about fix, see 'go doc cmd/fix'. 467 // For more about specifying packages, see 'go help packages'. 468 // 469 // To run fix with other options, run 'go tool fix'. 470 // 471 // See also: go fmt, go vet. 472 // 473 // 474 // Gofmt (reformat) package sources 475 // 476 // Usage: 477 // 478 // go fmt [-n] [-x] [packages] 479 // 480 // Fmt runs the command 'gofmt -l -w' on the packages named 481 // by the import paths. It prints the names of the files that are modified. 482 // 483 // For more about gofmt, see 'go doc cmd/gofmt'. 484 // For more about specifying packages, see 'go help packages'. 485 // 486 // The -n flag prints commands that would be executed. 487 // The -x flag prints commands as they are executed. 488 // 489 // The -mod flag's value sets which module download mode 490 // to use: readonly or vendor. See 'go help modules' for more. 491 // 492 // To run gofmt with specific options, run gofmt itself. 493 // 494 // See also: go fix, go vet. 495 // 496 // 497 // Generate Go files by processing source 498 // 499 // Usage: 500 // 501 // go generate [-run regexp] [-n] [-v] [-x] [build flags] [file.go... | packages] 502 // 503 // Generate runs commands described by directives within existing 504 // files. Those commands can run any process but the intent is to 505 // create or update Go source files. 506 // 507 // Go generate is never run automatically by go build, go test, 508 // and so on. It must be run explicitly. 509 // 510 // Go generate scans the file for directives, which are lines of 511 // the form, 512 // 513 // //go:generate command argument... 514 // 515 // (note: no leading spaces and no space in "//go") where command 516 // is the generator to be run, corresponding to an executable file 517 // that can be run locally. It must either be in the shell path 518 // (gofmt), a fully qualified path (/usr/you/bin/mytool), or a 519 // command alias, described below. 520 // 521 // Note that go generate does not parse the file, so lines that look 522 // like directives in comments or multiline strings will be treated 523 // as directives. 524 // 525 // The arguments to the directive are space-separated tokens or 526 // double-quoted strings passed to the generator as individual 527 // arguments when it is run. 528 // 529 // Quoted strings use Go syntax and are evaluated before execution; a 530 // quoted string appears as a single argument to the generator. 531 // 532 // To convey to humans and machine tools that code is generated, 533 // generated source should have a line that matches the following 534 // regular expression (in Go syntax): 535 // 536 // ^// Code generated .* DO NOT EDIT\.$ 537 // 538 // This line must appear before the first non-comment, non-blank 539 // text in the file. 540 // 541 // Go generate sets several variables when it runs the generator: 542 // 543 // $GOARCH 544 // The execution architecture (arm, amd64, etc.) 545 // $GOOS 546 // The execution operating system (linux, windows, etc.) 547 // $GOFILE 548 // The base name of the file. 549 // $GOLINE 550 // The line number of the directive in the source file. 551 // $GOPACKAGE 552 // The name of the package of the file containing the directive. 553 // $DOLLAR 554 // A dollar sign. 555 // 556 // Other than variable substitution and quoted-string evaluation, no 557 // special processing such as "globbing" is performed on the command 558 // line. 559 // 560 // As a last step before running the command, any invocations of any 561 // environment variables with alphanumeric names, such as $GOFILE or 562 // $HOME, are expanded throughout the command line. The syntax for 563 // variable expansion is $NAME on all operating systems. Due to the 564 // order of evaluation, variables are expanded even inside quoted 565 // strings. If the variable NAME is not set, $NAME expands to the 566 // empty string. 567 // 568 // A directive of the form, 569 // 570 // //go:generate -command xxx args... 571 // 572 // specifies, for the remainder of this source file only, that the 573 // string xxx represents the command identified by the arguments. This 574 // can be used to create aliases or to handle multiword generators. 575 // For example, 576 // 577 // //go:generate -command foo go tool foo 578 // 579 // specifies that the command "foo" represents the generator 580 // "go tool foo". 581 // 582 // Generate processes packages in the order given on the command line, 583 // one at a time. If the command line lists .go files from a single directory, 584 // they are treated as a single package. Within a package, generate processes the 585 // source files in a package in file name order, one at a time. Within 586 // a source file, generate runs generators in the order they appear 587 // in the file, one at a time. The go generate tool also sets the build 588 // tag "generate" so that files may be examined by go generate but ignored 589 // during build. 590 // 591 // For packages with invalid code, generate processes only source files with a 592 // valid package clause. 593 // 594 // If any generator returns an error exit status, "go generate" skips 595 // all further processing for that package. 596 // 597 // The generator is run in the package's source directory. 598 // 599 // Go generate accepts one specific flag: 600 // 601 // -run="" 602 // if non-empty, specifies a regular expression to select 603 // directives whose full original source text (excluding 604 // any trailing spaces and final newline) matches the 605 // expression. 606 // 607 // It also accepts the standard build flags including -v, -n, and -x. 608 // The -v flag prints the names of packages and files as they are 609 // processed. 610 // The -n flag prints commands that would be executed. 611 // The -x flag prints commands as they are executed. 612 // 613 // For more about build flags, see 'go help build'. 614 // 615 // For more about specifying packages, see 'go help packages'. 616 // 617 // 618 // Add dependencies to current module and install them 619 // 620 // Usage: 621 // 622 // go get [-t] [-u] [-v] [build flags] [packages] 623 // 624 // Get resolves its command-line arguments to packages at specific module versions, 625 // updates go.mod to require those versions, and downloads source code into the 626 // module cache. 627 // 628 // To add a dependency for a package or upgrade it to its latest version: 629 // 630 // go get example.com/pkg 631 // 632 // To upgrade or downgrade a package to a specific version: 633 // 634 // go get example.com/pkg@v1.2.3 635 // 636 // To remove a dependency on a module and downgrade modules that require it: 637 // 638 // go get example.com/mod@none 639 // 640 // See https://golang.org/ref/mod#go-get for details. 641 // 642 // In earlier versions of Go, 'go get' was used to build and install packages. 643 // Now, 'go get' is dedicated to adjusting dependencies in go.mod. 'go install' 644 // may be used to build and install commands instead. When a version is specified, 645 // 'go install' runs in module-aware mode and ignores the go.mod file in the 646 // current directory. For example: 647 // 648 // go install example.com/pkg@v1.2.3 649 // go install example.com/pkg@latest 650 // 651 // See 'go help install' or https://golang.org/ref/mod#go-install for details. 652 // 653 // 'go get' accepts the following flags. 654 // 655 // The -t flag instructs get to consider modules needed to build tests of 656 // packages specified on the command line. 657 // 658 // The -u flag instructs get to update modules providing dependencies 659 // of packages named on the command line to use newer minor or patch 660 // releases when available. 661 // 662 // The -u=patch flag (not -u patch) also instructs get to update dependencies, 663 // but changes the default to select patch releases. 664 // 665 // When the -t and -u flags are used together, get will update 666 // test dependencies as well. 667 // 668 // The -x flag prints commands as they are executed. This is useful for 669 // debugging version control commands when a module is downloaded directly 670 // from a repository. 671 // 672 // For more about modules, see https://golang.org/ref/mod. 673 // 674 // For more about specifying packages, see 'go help packages'. 675 // 676 // This text describes the behavior of get using modules to manage source 677 // code and dependencies. If instead the go command is running in GOPATH 678 // mode, the details of get's flags and effects change, as does 'go help get'. 679 // See 'go help gopath-get'. 680 // 681 // See also: go build, go install, go clean, go mod. 682 // 683 // 684 // Compile and install packages and dependencies 685 // 686 // Usage: 687 // 688 // go install [build flags] [packages] 689 // 690 // Install compiles and installs the packages named by the import paths. 691 // 692 // Executables are installed in the directory named by the GOBIN environment 693 // variable, which defaults to $GOPATH/bin or $HOME/go/bin if the GOPATH 694 // environment variable is not set. Executables in $GOROOT 695 // are installed in $GOROOT/bin or $GOTOOLDIR instead of $GOBIN. 696 // 697 // If the arguments have version suffixes (like @latest or @v1.0.0), "go install" 698 // builds packages in module-aware mode, ignoring the go.mod file in the current 699 // directory or any parent directory, if there is one. This is useful for 700 // installing executables without affecting the dependencies of the main module. 701 // To eliminate ambiguity about which module versions are used in the build, the 702 // arguments must satisfy the following constraints: 703 // 704 // - Arguments must be package paths or package patterns (with "..." wildcards). 705 // They must not be standard packages (like fmt), meta-patterns (std, cmd, 706 // all), or relative or absolute file paths. 707 // 708 // - All arguments must have the same version suffix. Different queries are not 709 // allowed, even if they refer to the same version. 710 // 711 // - All arguments must refer to packages in the same module at the same version. 712 // 713 // - Package path arguments must refer to main packages. Pattern arguments 714 // will only match main packages. 715 // 716 // - No module is considered the "main" module. If the module containing 717 // packages named on the command line has a go.mod file, it must not contain 718 // directives (replace and exclude) that would cause it to be interpreted 719 // differently than if it were the main module. The module must not require 720 // a higher version of itself. 721 // 722 // - Vendor directories are not used in any module. (Vendor directories are not 723 // included in the module zip files downloaded by 'go install'.) 724 // 725 // If the arguments don't have version suffixes, "go install" may run in 726 // module-aware mode or GOPATH mode, depending on the GO111MODULE environment 727 // variable and the presence of a go.mod file. See 'go help modules' for details. 728 // If module-aware mode is enabled, "go install" runs in the context of the main 729 // module. 730 // 731 // When module-aware mode is disabled, other packages are installed in the 732 // directory $GOPATH/pkg/$GOOS_$GOARCH. When module-aware mode is enabled, 733 // other packages are built and cached but not installed. 734 // 735 // The -i flag installs the dependencies of the named packages as well. 736 // The -i flag is deprecated. Compiled packages are cached automatically. 737 // 738 // For more about the build flags, see 'go help build'. 739 // For more about specifying packages, see 'go help packages'. 740 // 741 // See also: go build, go get, go clean. 742 // 743 // 744 // List packages or modules 745 // 746 // Usage: 747 // 748 // go list [-f format] [-json] [-m] [list flags] [build flags] [packages] 749 // 750 // List lists the named packages, one per line. 751 // The most commonly-used flags are -f and -json, which control the form 752 // of the output printed for each package. Other list flags, documented below, 753 // control more specific details. 754 // 755 // The default output shows the package import path: 756 // 757 // bytes 758 // encoding/json 759 // github.com/gorilla/mux 760 // golang.org/x/net/html 761 // 762 // The -f flag specifies an alternate format for the list, using the 763 // syntax of package template. The default output is equivalent 764 // to -f '{{.ImportPath}}'. The struct being passed to the template is: 765 // 766 // type Package struct { 767 // Dir string // directory containing package sources 768 // ImportPath string // import path of package in dir 769 // ImportComment string // path in import comment on package statement 770 // Name string // package name 771 // Doc string // package documentation string 772 // Target string // install path 773 // Shlib string // the shared library that contains this package (only set when -linkshared) 774 // Goroot bool // is this package in the Go root? 775 // Standard bool // is this package part of the standard Go library? 776 // Stale bool // would 'go install' do anything for this package? 777 // StaleReason string // explanation for Stale==true 778 // Root string // Go root or Go path dir containing this package 779 // ConflictDir string // this directory shadows Dir in $GOPATH 780 // BinaryOnly bool // binary-only package (no longer supported) 781 // ForTest string // package is only for use in named test 782 // Export string // file containing export data (when using -export) 783 // BuildID string // build ID of the compiled package (when using -export) 784 // Module *Module // info about package's containing module, if any (can be nil) 785 // Match []string // command-line patterns matching this package 786 // DepOnly bool // package is only a dependency, not explicitly listed 787 // 788 // // Source files 789 // GoFiles []string // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles) 790 // CgoFiles []string // .go source files that import "C" 791 // CompiledGoFiles []string // .go files presented to compiler (when using -compiled) 792 // IgnoredGoFiles []string // .go source files ignored due to build constraints 793 // IgnoredOtherFiles []string // non-.go source files ignored due to build constraints 794 // CFiles []string // .c source files 795 // CXXFiles []string // .cc, .cxx and .cpp source files 796 // MFiles []string // .m source files 797 // HFiles []string // .h, .hh, .hpp and .hxx source files 798 // FFiles []string // .f, .F, .for and .f90 Fortran source files 799 // SFiles []string // .s source files 800 // SwigFiles []string // .swig files 801 // SwigCXXFiles []string // .swigcxx files 802 // SysoFiles []string // .syso object files to add to archive 803 // TestGoFiles []string // _test.go files in package 804 // XTestGoFiles []string // _test.go files outside package 805 // 806 // // Embedded files 807 // EmbedPatterns []string // //go:embed patterns 808 // EmbedFiles []string // files matched by EmbedPatterns 809 // TestEmbedPatterns []string // //go:embed patterns in TestGoFiles 810 // TestEmbedFiles []string // files matched by TestEmbedPatterns 811 // XTestEmbedPatterns []string // //go:embed patterns in XTestGoFiles 812 // XTestEmbedFiles []string // files matched by XTestEmbedPatterns 813 // 814 // // Cgo directives 815 // CgoCFLAGS []string // cgo: flags for C compiler 816 // CgoCPPFLAGS []string // cgo: flags for C preprocessor 817 // CgoCXXFLAGS []string // cgo: flags for C++ compiler 818 // CgoFFLAGS []string // cgo: flags for Fortran compiler 819 // CgoLDFLAGS []string // cgo: flags for linker 820 // CgoPkgConfig []string // cgo: pkg-config names 821 // 822 // // Dependency information 823 // Imports []string // import paths used by this package 824 // ImportMap map[string]string // map from source import to ImportPath (identity entries omitted) 825 // Deps []string // all (recursively) imported dependencies 826 // TestImports []string // imports from TestGoFiles 827 // XTestImports []string // imports from XTestGoFiles 828 // 829 // // Error information 830 // Incomplete bool // this package or a dependency has an error 831 // Error *PackageError // error loading package 832 // DepsErrors []*PackageError // errors loading dependencies 833 // } 834 // 835 // Packages stored in vendor directories report an ImportPath that includes the 836 // path to the vendor directory (for example, "d/vendor/p" instead of "p"), 837 // so that the ImportPath uniquely identifies a given copy of a package. 838 // The Imports, Deps, TestImports, and XTestImports lists also contain these 839 // expanded import paths. See golang.org/s/go15vendor for more about vendoring. 840 // 841 // The error information, if any, is 842 // 843 // type PackageError struct { 844 // ImportStack []string // shortest path from package named on command line to this one 845 // Pos string // position of error (if present, file:line:col) 846 // Err string // the error itself 847 // } 848 // 849 // The module information is a Module struct, defined in the discussion 850 // of list -m below. 851 // 852 // The template function "join" calls strings.Join. 853 // 854 // The template function "context" returns the build context, defined as: 855 // 856 // type Context struct { 857 // GOARCH string // target architecture 858 // GOOS string // target operating system 859 // GOROOT string // Go root 860 // GOPATH string // Go path 861 // CgoEnabled bool // whether cgo can be used 862 // UseAllFiles bool // use files regardless of +build lines, file names 863 // Compiler string // compiler to assume when computing target paths 864 // BuildTags []string // build constraints to match in +build lines 865 // ToolTags []string // toolchain-specific build constraints 866 // ReleaseTags []string // releases the current release is compatible with 867 // InstallSuffix string // suffix to use in the name of the install dir 868 // } 869 // 870 // For more information about the meaning of these fields see the documentation 871 // for the go/build package's Context type. 872 // 873 // The -json flag causes the package data to be printed in JSON format 874 // instead of using the template format. 875 // 876 // The -compiled flag causes list to set CompiledGoFiles to the Go source 877 // files presented to the compiler. Typically this means that it repeats 878 // the files listed in GoFiles and then also adds the Go code generated 879 // by processing CgoFiles and SwigFiles. The Imports list contains the 880 // union of all imports from both GoFiles and CompiledGoFiles. 881 // 882 // The -deps flag causes list to iterate over not just the named packages 883 // but also all their dependencies. It visits them in a depth-first post-order 884 // traversal, so that a package is listed only after all its dependencies. 885 // Packages not explicitly listed on the command line will have the DepOnly 886 // field set to true. 887 // 888 // The -e flag changes the handling of erroneous packages, those that 889 // cannot be found or are malformed. By default, the list command 890 // prints an error to standard error for each erroneous package and 891 // omits the packages from consideration during the usual printing. 892 // With the -e flag, the list command never prints errors to standard 893 // error and instead processes the erroneous packages with the usual 894 // printing. Erroneous packages will have a non-empty ImportPath and 895 // a non-nil Error field; other information may or may not be missing 896 // (zeroed). 897 // 898 // The -export flag causes list to set the Export field to the name of a 899 // file containing up-to-date export information for the given package. 900 // 901 // The -find flag causes list to identify the named packages but not 902 // resolve their dependencies: the Imports and Deps lists will be empty. 903 // 904 // The -test flag causes list to report not only the named packages 905 // but also their test binaries (for packages with tests), to convey to 906 // source code analysis tools exactly how test binaries are constructed. 907 // The reported import path for a test binary is the import path of 908 // the package followed by a ".test" suffix, as in "math/rand.test". 909 // When building a test, it is sometimes necessary to rebuild certain 910 // dependencies specially for that test (most commonly the tested 911 // package itself). The reported import path of a package recompiled 912 // for a particular test binary is followed by a space and the name of 913 // the test binary in brackets, as in "math/rand [math/rand.test]" 914 // or "regexp [sort.test]". The ForTest field is also set to the name 915 // of the package being tested ("math/rand" or "sort" in the previous 916 // examples). 917 // 918 // The Dir, Target, Shlib, Root, ConflictDir, and Export file paths 919 // are all absolute paths. 920 // 921 // By default, the lists GoFiles, CgoFiles, and so on hold names of files in Dir 922 // (that is, paths relative to Dir, not absolute paths). 923 // The generated files added when using the -compiled and -test flags 924 // are absolute paths referring to cached copies of generated Go source files. 925 // Although they are Go source files, the paths may not end in ".go". 926 // 927 // The -m flag causes list to list modules instead of packages. 928 // 929 // When listing modules, the -f flag still specifies a format template 930 // applied to a Go struct, but now a Module struct: 931 // 932 // type Module struct { 933 // Path string // module path 934 // Version string // module version 935 // Versions []string // available module versions (with -versions) 936 // Replace *Module // replaced by this module 937 // Time *time.Time // time version was created 938 // Update *Module // available update, if any (with -u) 939 // Main bool // is this the main module? 940 // Indirect bool // is this module only an indirect dependency of main module? 941 // Dir string // directory holding files for this module, if any 942 // GoMod string // path to go.mod file used when loading this module, if any 943 // GoVersion string // go version used in module 944 // Retracted string // retraction information, if any (with -retracted or -u) 945 // Error *ModuleError // error loading module 946 // } 947 // 948 // type ModuleError struct { 949 // Err string // the error itself 950 // } 951 // 952 // The file GoMod refers to may be outside the module directory if the 953 // module is in the module cache or if the -modfile flag is used. 954 // 955 // The default output is to print the module path and then 956 // information about the version and replacement if any. 957 // For example, 'go list -m all' might print: 958 // 959 // my/main/module 960 // golang.org/x/text v0.3.0 => /tmp/text 961 // rsc.io/pdf v0.1.1 962 // 963 // The Module struct has a String method that formats this 964 // line of output, so that the default format is equivalent 965 // to -f '{{.String}}'. 966 // 967 // Note that when a module has been replaced, its Replace field 968 // describes the replacement module, and its Dir field is set to 969 // the replacement's source code, if present. (That is, if Replace 970 // is non-nil, then Dir is set to Replace.Dir, with no access to 971 // the replaced source code.) 972 // 973 // The -u flag adds information about available upgrades. 974 // When the latest version of a given module is newer than 975 // the current one, list -u sets the Module's Update field 976 // to information about the newer module. list -u will also set 977 // the module's Retracted field if the current version is retracted. 978 // The Module's String method indicates an available upgrade by 979 // formatting the newer version in brackets after the current version. 980 // If a version is retracted, the string "(retracted)" will follow it. 981 // For example, 'go list -m -u all' might print: 982 // 983 // my/main/module 984 // golang.org/x/text v0.3.0 [v0.4.0] => /tmp/text 985 // rsc.io/pdf v0.1.1 (retracted) [v0.1.2] 986 // 987 // (For tools, 'go list -m -u -json all' may be more convenient to parse.) 988 // 989 // The -versions flag causes list to set the Module's Versions field 990 // to a list of all known versions of that module, ordered according 991 // to semantic versioning, earliest to latest. The flag also changes 992 // the default output format to display the module path followed by the 993 // space-separated version list. 994 // 995 // The -retracted flag causes list to report information about retracted 996 // module versions. When -retracted is used with -f or -json, the Retracted 997 // field will be set to a string explaining why the version was retracted. 998 // The string is taken from comments on the retract directive in the 999 // module's go.mod file. When -retracted is used with -versions, retracted 1000 // versions are listed together with unretracted versions. The -retracted 1001 // flag may be used with or without -m. 1002 // 1003 // The arguments to list -m are interpreted as a list of modules, not packages. 1004 // The main module is the module containing the current directory. 1005 // The active modules are the main module and its dependencies. 1006 // With no arguments, list -m shows the main module. 1007 // With arguments, list -m shows the modules specified by the arguments. 1008 // Any of the active modules can be specified by its module path. 1009 // The special pattern "all" specifies all the active modules, first the main 1010 // module and then dependencies sorted by module path. 1011 // A pattern containing "..." specifies the active modules whose 1012 // module paths match the pattern. 1013 // A query of the form path@version specifies the result of that query, 1014 // which is not limited to active modules. 1015 // See 'go help modules' for more about module queries. 1016 // 1017 // The template function "module" takes a single string argument 1018 // that must be a module path or query and returns the specified 1019 // module as a Module struct. If an error occurs, the result will 1020 // be a Module struct with a non-nil Error field. 1021 // 1022 // For more about build flags, see 'go help build'. 1023 // 1024 // For more about specifying packages, see 'go help packages'. 1025 // 1026 // For more about modules, see https://golang.org/ref/mod. 1027 // 1028 // 1029 // Module maintenance 1030 // 1031 // Go mod provides access to operations on modules. 1032 // 1033 // Note that support for modules is built into all the go commands, 1034 // not just 'go mod'. For example, day-to-day adding, removing, upgrading, 1035 // and downgrading of dependencies should be done using 'go get'. 1036 // See 'go help modules' for an overview of module functionality. 1037 // 1038 // Usage: 1039 // 1040 // go mod <command> [arguments] 1041 // 1042 // The commands are: 1043 // 1044 // download download modules to local cache 1045 // edit edit go.mod from tools or scripts 1046 // graph print module requirement graph 1047 // init initialize new module in current directory 1048 // tidy add missing and remove unused modules 1049 // vendor make vendored copy of dependencies 1050 // verify verify dependencies have expected content 1051 // why explain why packages or modules are needed 1052 // 1053 // Use "go help mod <command>" for more information about a command. 1054 // 1055 // Download modules to local cache 1056 // 1057 // Usage: 1058 // 1059 // go mod download [-x] [-json] [modules] 1060 // 1061 // Download downloads the named modules, which can be module patterns selecting 1062 // dependencies of the main module or module queries of the form path@version. 1063 // 1064 // With no arguments, download applies to the modules needed to build and test 1065 // the packages in the main module: the modules explicitly required by the main 1066 // module if it is at 'go 1.17' or higher, or all transitively-required modules 1067 // if at 'go 1.16' or lower. 1068 // 1069 // The go command will automatically download modules as needed during ordinary 1070 // execution. The "go mod download" command is useful mainly for pre-filling 1071 // the local cache or to compute the answers for a Go module proxy. 1072 // 1073 // By default, download writes nothing to standard output. It may print progress 1074 // messages and errors to standard error. 1075 // 1076 // The -json flag causes download to print a sequence of JSON objects 1077 // to standard output, describing each downloaded module (or failure), 1078 // corresponding to this Go struct: 1079 // 1080 // type Module struct { 1081 // Path string // module path 1082 // Version string // module version 1083 // Error string // error loading module 1084 // Info string // absolute path to cached .info file 1085 // GoMod string // absolute path to cached .mod file 1086 // Zip string // absolute path to cached .zip file 1087 // Dir string // absolute path to cached source root directory 1088 // Sum string // checksum for path, version (as in go.sum) 1089 // GoModSum string // checksum for go.mod (as in go.sum) 1090 // } 1091 // 1092 // The -x flag causes download to print the commands download executes. 1093 // 1094 // See https://golang.org/ref/mod#go-mod-download for more about 'go mod download'. 1095 // 1096 // See https://golang.org/ref/mod#version-queries for more about version queries. 1097 // 1098 // 1099 // Edit go.mod from tools or scripts 1100 // 1101 // Usage: 1102 // 1103 // go mod edit [editing flags] [-fmt|-print|-json] [go.mod] 1104 // 1105 // Edit provides a command-line interface for editing go.mod, 1106 // for use primarily by tools or scripts. It reads only go.mod; 1107 // it does not look up information about the modules involved. 1108 // By default, edit reads and writes the go.mod file of the main module, 1109 // but a different target file can be specified after the editing flags. 1110 // 1111 // The editing flags specify a sequence of editing operations. 1112 // 1113 // The -fmt flag reformats the go.mod file without making other changes. 1114 // This reformatting is also implied by any other modifications that use or 1115 // rewrite the go.mod file. The only time this flag is needed is if no other 1116 // flags are specified, as in 'go mod edit -fmt'. 1117 // 1118 // The -module flag changes the module's path (the go.mod file's module line). 1119 // 1120 // The -require=path@version and -droprequire=path flags 1121 // add and drop a requirement on the given module path and version. 1122 // Note that -require overrides any existing requirements on path. 1123 // These flags are mainly for tools that understand the module graph. 1124 // Users should prefer 'go get path@version' or 'go get path@none', 1125 // which make other go.mod adjustments as needed to satisfy 1126 // constraints imposed by other modules. 1127 // 1128 // The -exclude=path@version and -dropexclude=path@version flags 1129 // add and drop an exclusion for the given module path and version. 1130 // Note that -exclude=path@version is a no-op if that exclusion already exists. 1131 // 1132 // The -replace=old[@v]=new[@v] flag adds a replacement of the given 1133 // module path and version pair. If the @v in old@v is omitted, a 1134 // replacement without a version on the left side is added, which applies 1135 // to all versions of the old module path. If the @v in new@v is omitted, 1136 // the new path should be a local module root directory, not a module 1137 // path. Note that -replace overrides any redundant replacements for old[@v], 1138 // so omitting @v will drop existing replacements for specific versions. 1139 // 1140 // The -dropreplace=old[@v] flag drops a replacement of the given 1141 // module path and version pair. If the @v is omitted, a replacement without 1142 // a version on the left side is dropped. 1143 // 1144 // The -retract=version and -dropretract=version flags add and drop a 1145 // retraction on the given version. The version may be a single version 1146 // like "v1.2.3" or a closed interval like "[v1.1.0,v1.1.9]". Note that 1147 // -retract=version is a no-op if that retraction already exists. 1148 // 1149 // The -require, -droprequire, -exclude, -dropexclude, -replace, 1150 // -dropreplace, -retract, and -dropretract editing flags may be repeated, 1151 // and the changes are applied in the order given. 1152 // 1153 // The -go=version flag sets the expected Go language version. 1154 // 1155 // The -print flag prints the final go.mod in its text format instead of 1156 // writing it back to go.mod. 1157 // 1158 // The -json flag prints the final go.mod file in JSON format instead of 1159 // writing it back to go.mod. The JSON output corresponds to these Go types: 1160 // 1161 // type Module struct { 1162 // Path string 1163 // Version string 1164 // } 1165 // 1166 // type GoMod struct { 1167 // Module ModPath 1168 // Go string 1169 // Require []Require 1170 // Exclude []Module 1171 // Replace []Replace 1172 // Retract []Retract 1173 // } 1174 // 1175 // type ModPath struct { 1176 // Path string 1177 // Deprecated string 1178 // } 1179 // 1180 // type Require struct { 1181 // Path string 1182 // Version string 1183 // Indirect bool 1184 // } 1185 // 1186 // type Replace struct { 1187 // Old Module 1188 // New Module 1189 // } 1190 // 1191 // type Retract struct { 1192 // Low string 1193 // High string 1194 // Rationale string 1195 // } 1196 // 1197 // Retract entries representing a single version (not an interval) will have 1198 // the "Low" and "High" fields set to the same value. 1199 // 1200 // Note that this only describes the go.mod file itself, not other modules 1201 // referred to indirectly. For the full set of modules available to a build, 1202 // use 'go list -m -json all'. 1203 // 1204 // See https://golang.org/ref/mod#go-mod-edit for more about 'go mod edit'. 1205 // 1206 // 1207 // Print module requirement graph 1208 // 1209 // Usage: 1210 // 1211 // go mod graph [-go=version] 1212 // 1213 // Graph prints the module requirement graph (with replacements applied) 1214 // in text form. Each line in the output has two space-separated fields: a module 1215 // and one of its requirements. Each module is identified as a string of the form 1216 // path@version, except for the main module, which has no @version suffix. 1217 // 1218 // The -go flag causes graph to report the module graph as loaded by the 1219 // given Go version, instead of the version indicated by the 'go' directive 1220 // in the go.mod file. 1221 // 1222 // See https://golang.org/ref/mod#go-mod-graph for more about 'go mod graph'. 1223 // 1224 // 1225 // Initialize new module in current directory 1226 // 1227 // Usage: 1228 // 1229 // go mod init [module-path] 1230 // 1231 // Init initializes and writes a new go.mod file in the current directory, in 1232 // effect creating a new module rooted at the current directory. The go.mod file 1233 // must not already exist. 1234 // 1235 // Init accepts one optional argument, the module path for the new module. If the 1236 // module path argument is omitted, init will attempt to infer the module path 1237 // using import comments in .go files, vendoring tool configuration files (like 1238 // Gopkg.lock), and the current directory (if in GOPATH). 1239 // 1240 // If a configuration file for a vendoring tool is present, init will attempt to 1241 // import module requirements from it. 1242 // 1243 // See https://golang.org/ref/mod#go-mod-init for more about 'go mod init'. 1244 // 1245 // 1246 // Add missing and remove unused modules 1247 // 1248 // Usage: 1249 // 1250 // go mod tidy [-e] [-v] [-go=version] [-compat=version] 1251 // 1252 // Tidy makes sure go.mod matches the source code in the module. 1253 // It adds any missing modules necessary to build the current module's 1254 // packages and dependencies, and it removes unused modules that 1255 // don't provide any relevant packages. It also adds any missing entries 1256 // to go.sum and removes any unnecessary ones. 1257 // 1258 // The -v flag causes tidy to print information about removed modules 1259 // to standard error. 1260 // 1261 // The -e flag causes tidy to attempt to proceed despite errors 1262 // encountered while loading packages. 1263 // 1264 // The -go flag causes tidy to update the 'go' directive in the go.mod 1265 // file to the given version, which may change which module dependencies 1266 // are retained as explicit requirements in the go.mod file. 1267 // (Go versions 1.17 and higher retain more requirements in order to 1268 // support lazy module loading.) 1269 // 1270 // The -compat flag preserves any additional checksums needed for the 1271 // 'go' command from the indicated major Go release to successfully load 1272 // the module graph, and causes tidy to error out if that version of the 1273 // 'go' command would load any imported package from a different module 1274 // version. By default, tidy acts as if the -compat flag were set to the 1275 // version prior to the one indicated by the 'go' directive in the go.mod 1276 // file. 1277 // 1278 // See https://golang.org/ref/mod#go-mod-tidy for more about 'go mod tidy'. 1279 // 1280 // 1281 // Make vendored copy of dependencies 1282 // 1283 // Usage: 1284 // 1285 // go mod vendor [-e] [-v] [-o outdir] 1286 // 1287 // Vendor resets the main module's vendor directory to include all packages 1288 // needed to build and test all the main module's packages. 1289 // It does not include test code for vendored packages. 1290 // 1291 // The -v flag causes vendor to print the names of vendored 1292 // modules and packages to standard error. 1293 // 1294 // The -e flag causes vendor to attempt to proceed despite errors 1295 // encountered while loading packages. 1296 // 1297 // The -o flag causes vendor to create the vendor directory at the given 1298 // path instead of "vendor". The go command can only use a vendor directory 1299 // named "vendor" within the module root directory, so this flag is 1300 // primarily useful for other tools. 1301 // 1302 // See https://golang.org/ref/mod#go-mod-vendor for more about 'go mod vendor'. 1303 // 1304 // 1305 // Verify dependencies have expected content 1306 // 1307 // Usage: 1308 // 1309 // go mod verify 1310 // 1311 // Verify checks that the dependencies of the current module, 1312 // which are stored in a local downloaded source cache, have not been 1313 // modified since being downloaded. If all the modules are unmodified, 1314 // verify prints "all modules verified." Otherwise it reports which 1315 // modules have been changed and causes 'go mod' to exit with a 1316 // non-zero status. 1317 // 1318 // See https://golang.org/ref/mod#go-mod-verify for more about 'go mod verify'. 1319 // 1320 // 1321 // Explain why packages or modules are needed 1322 // 1323 // Usage: 1324 // 1325 // go mod why [-m] [-vendor] packages... 1326 // 1327 // Why shows a shortest path in the import graph from the main module to 1328 // each of the listed packages. If the -m flag is given, why treats the 1329 // arguments as a list of modules and finds a path to any package in each 1330 // of the modules. 1331 // 1332 // By default, why queries the graph of packages matched by "go list all", 1333 // which includes tests for reachable packages. The -vendor flag causes why 1334 // to exclude tests of dependencies. 1335 // 1336 // The output is a sequence of stanzas, one for each package or module 1337 // name on the command line, separated by blank lines. Each stanza begins 1338 // with a comment line "# package" or "# module" giving the target 1339 // package or module. Subsequent lines give a path through the import 1340 // graph, one package per line. If the package or module is not 1341 // referenced from the main module, the stanza will display a single 1342 // parenthesized note indicating that fact. 1343 // 1344 // For example: 1345 // 1346 // $ go mod why golang.org/x/text/language golang.org/x/text/encoding 1347 // # golang.org/x/text/language 1348 // rsc.io/quote 1349 // rsc.io/sampler 1350 // golang.org/x/text/language 1351 // 1352 // # golang.org/x/text/encoding 1353 // (main module does not need package golang.org/x/text/encoding) 1354 // $ 1355 // 1356 // See https://golang.org/ref/mod#go-mod-why for more about 'go mod why'. 1357 // 1358 // 1359 // Workspace maintenance 1360 // 1361 // Work provides access to operations on workspaces. 1362 // 1363 // Note that support for workspaces is built into many other commands, not 1364 // just 'go work'. 1365 // 1366 // See 'go help modules' for information about Go's module system of which 1367 // workspaces are a part. 1368 // 1369 // See https://go.dev/ref/mod#workspaces for an in-depth reference on 1370 // workspaces. 1371 // 1372 // See https://go.dev/doc/tutorial/workspaces for an introductory 1373 // tutorial on workspaces. 1374 // 1375 // A workspace is specified by a go.work file that specifies a set of 1376 // module directories with the "use" directive. These modules are used as 1377 // root modules by the go command for builds and related operations. A 1378 // workspace that does not specify modules to be used cannot be used to do 1379 // builds from local modules. 1380 // 1381 // go.work files are line-oriented. Each line holds a single directive, 1382 // made up of a keyword followed by arguments. For example: 1383 // 1384 // go 1.18 1385 // 1386 // use ../foo/bar 1387 // use ./baz 1388 // 1389 // replace example.com/foo v1.2.3 => example.com/bar v1.4.5 1390 // 1391 // The leading keyword can be factored out of adjacent lines to create a block, 1392 // like in Go imports. 1393 // 1394 // use ( 1395 // ../foo/bar 1396 // ./baz 1397 // ) 1398 // 1399 // The use directive specifies a module to be included in the workspace's 1400 // set of main modules. The argument to the use directive is the directory 1401 // containing the module's go.mod file. 1402 // 1403 // The go directive specifies the version of Go the file was written at. It 1404 // is possible there may be future changes in the semantics of workspaces 1405 // that could be controlled by this version, but for now the version 1406 // specified has no effect. 1407 // 1408 // The replace directive has the same syntax as the replace directive in a 1409 // go.mod file and takes precedence over replaces in go.mod files. It is 1410 // primarily intended to override conflicting replaces in different workspace 1411 // modules. 1412 // 1413 // To determine whether the go command is operating in workspace mode, use 1414 // the "go env GOWORK" command. This will specify the workspace file being 1415 // used. 1416 // 1417 // Usage: 1418 // 1419 // go work <command> [arguments] 1420 // 1421 // The commands are: 1422 // 1423 // edit edit go.work from tools or scripts 1424 // init initialize workspace file 1425 // sync sync workspace build list to modules 1426 // use add modules to workspace file 1427 // 1428 // Use "go help work <command>" for more information about a command. 1429 // 1430 // Edit go.work from tools or scripts 1431 // 1432 // Usage: 1433 // 1434 // go work edit [editing flags] [go.work] 1435 // 1436 // Edit provides a command-line interface for editing go.work, 1437 // for use primarily by tools or scripts. It only reads go.work; 1438 // it does not look up information about the modules involved. 1439 // If no file is specified, Edit looks for a go.work file in the current 1440 // directory and its parent directories 1441 // 1442 // The editing flags specify a sequence of editing operations. 1443 // 1444 // The -fmt flag reformats the go.work file without making other changes. 1445 // This reformatting is also implied by any other modifications that use or 1446 // rewrite the go.mod file. The only time this flag is needed is if no other 1447 // flags are specified, as in 'go work edit -fmt'. 1448 // 1449 // The -use=path and -dropuse=path flags 1450 // add and drop a use directive from the go.work file's set of module directories. 1451 // 1452 // The -replace=old[@v]=new[@v] flag adds a replacement of the given 1453 // module path and version pair. If the @v in old@v is omitted, a 1454 // replacement without a version on the left side is added, which applies 1455 // to all versions of the old module path. If the @v in new@v is omitted, 1456 // the new path should be a local module root directory, not a module 1457 // path. Note that -replace overrides any redundant replacements for old[@v], 1458 // so omitting @v will drop existing replacements for specific versions. 1459 // 1460 // The -dropreplace=old[@v] flag drops a replacement of the given 1461 // module path and version pair. If the @v is omitted, a replacement without 1462 // a version on the left side is dropped. 1463 // 1464 // The -use, -dropuse, -replace, and -dropreplace, 1465 // editing flags may be repeated, and the changes are applied in the order given. 1466 // 1467 // The -go=version flag sets the expected Go language version. 1468 // 1469 // The -print flag prints the final go.work in its text format instead of 1470 // writing it back to go.mod. 1471 // 1472 // The -json flag prints the final go.work file in JSON format instead of 1473 // writing it back to go.mod. The JSON output corresponds to these Go types: 1474 // 1475 // type GoWork struct { 1476 // Go string 1477 // Use []Use 1478 // Replace []Replace 1479 // } 1480 // 1481 // type Use struct { 1482 // DiskPath string 1483 // ModulePath string 1484 // } 1485 // 1486 // type Replace struct { 1487 // Old Module 1488 // New Module 1489 // } 1490 // 1491 // type Module struct { 1492 // Path string 1493 // Version string 1494 // } 1495 // 1496 // See the workspaces reference at https://go.dev/ref/mod#workspaces 1497 // for more information. 1498 // 1499 // 1500 // Initialize workspace file 1501 // 1502 // Usage: 1503 // 1504 // go work init [moddirs] 1505 // 1506 // Init initializes and writes a new go.work file in the 1507 // current directory, in effect creating a new workspace at the current 1508 // directory. 1509 // 1510 // go work init optionally accepts paths to the workspace modules as 1511 // arguments. If the argument is omitted, an empty workspace with no 1512 // modules will be created. 1513 // 1514 // Each argument path is added to a use directive in the go.work file. The 1515 // current go version will also be listed in the go.work file. 1516 // 1517 // See the workspaces reference at https://go.dev/ref/mod#workspaces 1518 // for more information. 1519 // 1520 // 1521 // Sync workspace build list to modules 1522 // 1523 // Usage: 1524 // 1525 // go work sync 1526 // 1527 // Sync syncs the workspace's build list back to the 1528 // workspace's modules 1529 // 1530 // The workspace's build list is the set of versions of all the 1531 // (transitive) dependency modules used to do builds in the workspace. go 1532 // work sync generates that build list using the Minimal Version Selection 1533 // algorithm, and then syncs those versions back to each of modules 1534 // specified in the workspace (with use directives). 1535 // 1536 // The syncing is done by sequentially upgrading each of the dependency 1537 // modules specified in a workspace module to the version in the build list 1538 // if the dependency module's version is not already the same as the build 1539 // list's version. Note that Minimal Version Selection guarantees that the 1540 // build list's version of each module is always the same or higher than 1541 // that in each workspace module. 1542 // 1543 // See the workspaces reference at https://go.dev/ref/mod#workspaces 1544 // for more information. 1545 // 1546 // 1547 // Add modules to workspace file 1548 // 1549 // Usage: 1550 // 1551 // go work use [-r] moddirs 1552 // 1553 // Use provides a command-line interface for adding 1554 // directories, optionally recursively, to a go.work file. 1555 // 1556 // A use directive will be added to the go.work file for each argument 1557 // directory listed on the command line go.work file, if it exists on disk, 1558 // or removed from the go.work file if it does not exist on disk. 1559 // 1560 // The -r flag searches recursively for modules in the argument 1561 // directories, and the use command operates as if each of the directories 1562 // were specified as arguments: namely, use directives will be added for 1563 // directories that exist, and removed for directories that do not exist. 1564 // 1565 // See the workspaces reference at https://go.dev/ref/mod#workspaces 1566 // for more information. 1567 // 1568 // 1569 // Compile and run Go program 1570 // 1571 // Usage: 1572 // 1573 // go run [build flags] [-exec xprog] package [arguments...] 1574 // 1575 // Run compiles and runs the named main Go package. 1576 // Typically the package is specified as a list of .go source files from a single 1577 // directory, but it may also be an import path, file system path, or pattern 1578 // matching a single known package, as in 'go run .' or 'go run my/cmd'. 1579 // 1580 // If the package argument has a version suffix (like @latest or @v1.0.0), 1581 // "go run" builds the program in module-aware mode, ignoring the go.mod file in 1582 // the current directory or any parent directory, if there is one. This is useful 1583 // for running programs without affecting the dependencies of the main module. 1584 // 1585 // If the package argument doesn't have a version suffix, "go run" may run in 1586 // module-aware mode or GOPATH mode, depending on the GO111MODULE environment 1587 // variable and the presence of a go.mod file. See 'go help modules' for details. 1588 // If module-aware mode is enabled, "go run" runs in the context of the main 1589 // module. 1590 // 1591 // By default, 'go run' runs the compiled binary directly: 'a.out arguments...'. 1592 // If the -exec flag is given, 'go run' invokes the binary using xprog: 1593 // 'xprog a.out arguments...'. 1594 // If the -exec flag is not given, GOOS or GOARCH is different from the system 1595 // default, and a program named go_$GOOS_$GOARCH_exec can be found 1596 // on the current search path, 'go run' invokes the binary using that program, 1597 // for example 'go_js_wasm_exec a.out arguments...'. This allows execution of 1598 // cross-compiled programs when a simulator or other execution method is 1599 // available. 1600 // 1601 // The exit status of Run is not the exit status of the compiled binary. 1602 // 1603 // For more about build flags, see 'go help build'. 1604 // For more about specifying packages, see 'go help packages'. 1605 // 1606 // See also: go build. 1607 // 1608 // 1609 // Test packages 1610 // 1611 // Usage: 1612 // 1613 // go test [build/test flags] [packages] [build/test flags & test binary flags] 1614 // 1615 // 'Go test' automates testing the packages named by the import paths. 1616 // It prints a summary of the test results in the format: 1617 // 1618 // ok archive/tar 0.011s 1619 // FAIL archive/zip 0.022s 1620 // ok compress/gzip 0.033s 1621 // ... 1622 // 1623 // followed by detailed output for each failed package. 1624 // 1625 // 'Go test' recompiles each package along with any files with names matching 1626 // the file pattern "*_test.go". 1627 // These additional files can contain test functions, benchmark functions, fuzz 1628 // tests and example functions. See 'go help testfunc' for more. 1629 // Each listed package causes the execution of a separate test binary. 1630 // Files whose names begin with "_" (including "_test.go") or "." are ignored. 1631 // 1632 // Test files that declare a package with the suffix "_test" will be compiled as a 1633 // separate package, and then linked and run with the main test binary. 1634 // 1635 // The go tool will ignore a directory named "testdata", making it available 1636 // to hold ancillary data needed by the tests. 1637 // 1638 // As part of building a test binary, go test runs go vet on the package 1639 // and its test source files to identify significant problems. If go vet 1640 // finds any problems, go test reports those and does not run the test 1641 // binary. Only a high-confidence subset of the default go vet checks are 1642 // used. That subset is: 'atomic', 'bool', 'buildtags', 'errorsas', 1643 // 'ifaceassert', 'nilfunc', 'printf', and 'stringintconv'. You can see 1644 // the documentation for these and other vet tests via "go doc cmd/vet". 1645 // To disable the running of go vet, use the -vet=off flag. To run all 1646 // checks, use the -vet=all flag. 1647 // 1648 // All test output and summary lines are printed to the go command's 1649 // standard output, even if the test printed them to its own standard 1650 // error. (The go command's standard error is reserved for printing 1651 // errors building the tests.) 1652 // 1653 // Go test runs in two different modes: 1654 // 1655 // The first, called local directory mode, occurs when go test is 1656 // invoked with no package arguments (for example, 'go test' or 'go 1657 // test -v'). In this mode, go test compiles the package sources and 1658 // tests found in the current directory and then runs the resulting 1659 // test binary. In this mode, caching (discussed below) is disabled. 1660 // After the package test finishes, go test prints a summary line 1661 // showing the test status ('ok' or 'FAIL'), package name, and elapsed 1662 // time. 1663 // 1664 // The second, called package list mode, occurs when go test is invoked 1665 // with explicit package arguments (for example 'go test math', 'go 1666 // test ./...', and even 'go test .'). In this mode, go test compiles 1667 // and tests each of the packages listed on the command line. If a 1668 // package test passes, go test prints only the final 'ok' summary 1669 // line. If a package test fails, go test prints the full test output. 1670 // If invoked with the -bench or -v flag, go test prints the full 1671 // output even for passing package tests, in order to display the 1672 // requested benchmark results or verbose logging. After the package 1673 // tests for all of the listed packages finish, and their output is 1674 // printed, go test prints a final 'FAIL' status if any package test 1675 // has failed. 1676 // 1677 // In package list mode only, go test caches successful package test 1678 // results to avoid unnecessary repeated running of tests. When the 1679 // result of a test can be recovered from the cache, go test will 1680 // redisplay the previous output instead of running the test binary 1681 // again. When this happens, go test prints '(cached)' in place of the 1682 // elapsed time in the summary line. 1683 // 1684 // The rule for a match in the cache is that the run involves the same 1685 // test binary and the flags on the command line come entirely from a 1686 // restricted set of 'cacheable' test flags, defined as -benchtime, -cpu, 1687 // -list, -parallel, -run, -short, -timeout, -failfast, and -v. 1688 // If a run of go test has any test or non-test flags outside this set, 1689 // the result is not cached. To disable test caching, use any test flag 1690 // or argument other than the cacheable flags. The idiomatic way to disable 1691 // test caching explicitly is to use -count=1. Tests that open files within 1692 // the package's source root (usually $GOPATH) or that consult environment 1693 // variables only match future runs in which the files and environment 1694 // variables are unchanged. A cached test result is treated as executing 1695 // in no time at all,so a successful package test result will be cached and 1696 // reused regardless of -timeout setting. 1697 // 1698 // In addition to the build flags, the flags handled by 'go test' itself are: 1699 // 1700 // -args 1701 // Pass the remainder of the command line (everything after -args) 1702 // to the test binary, uninterpreted and unchanged. 1703 // Because this flag consumes the remainder of the command line, 1704 // the package list (if present) must appear before this flag. 1705 // 1706 // -c 1707 // Compile the test binary to pkg.test but do not run it 1708 // (where pkg is the last element of the package's import path). 1709 // The file name can be changed with the -o flag. 1710 // 1711 // -exec xprog 1712 // Run the test binary using xprog. The behavior is the same as 1713 // in 'go run'. See 'go help run' for details. 1714 // 1715 // -i 1716 // Install packages that are dependencies of the test. 1717 // Do not run the test. 1718 // The -i flag is deprecated. Compiled packages are cached automatically. 1719 // 1720 // -json 1721 // Convert test output to JSON suitable for automated processing. 1722 // See 'go doc test2json' for the encoding details. 1723 // 1724 // -o file 1725 // Compile the test binary to the named file. 1726 // The test still runs (unless -c or -i is specified). 1727 // 1728 // The test binary also accepts flags that control execution of the test; these 1729 // flags are also accessible by 'go test'. See 'go help testflag' for details. 1730 // 1731 // For more about build flags, see 'go help build'. 1732 // For more about specifying packages, see 'go help packages'. 1733 // 1734 // See also: go build, go vet. 1735 // 1736 // 1737 // Run specified go tool 1738 // 1739 // Usage: 1740 // 1741 // go tool [-n] command [args...] 1742 // 1743 // Tool runs the go tool command identified by the arguments. 1744 // With no arguments it prints the list of known tools. 1745 // 1746 // The -n flag causes tool to print the command that would be 1747 // executed but not execute it. 1748 // 1749 // For more about each tool command, see 'go doc cmd/<command>'. 1750 // 1751 // 1752 // Print Go version 1753 // 1754 // Usage: 1755 // 1756 // go version [-m] [-v] [file ...] 1757 // 1758 // Version prints the build information for Go executables. 1759 // 1760 // Go version reports the Go version used to build each of the named 1761 // executable files. 1762 // 1763 // If no files are named on the command line, go version prints its own 1764 // version information. 1765 // 1766 // If a directory is named, go version walks that directory, recursively, 1767 // looking for recognized Go binaries and reporting their versions. 1768 // By default, go version does not report unrecognized files found 1769 // during a directory scan. The -v flag causes it to report unrecognized files. 1770 // 1771 // The -m flag causes go version to print each executable's embedded 1772 // module version information, when available. In the output, the module 1773 // information consists of multiple lines following the version line, each 1774 // indented by a leading tab character. 1775 // 1776 // See also: go doc runtime/debug.BuildInfo. 1777 // 1778 // 1779 // Report likely mistakes in packages 1780 // 1781 // Usage: 1782 // 1783 // go vet [-n] [-x] [-vettool prog] [build flags] [vet flags] [packages] 1784 // 1785 // Vet runs the Go vet command on the packages named by the import paths. 1786 // 1787 // For more about vet and its flags, see 'go doc cmd/vet'. 1788 // For more about specifying packages, see 'go help packages'. 1789 // For a list of checkers and their flags, see 'go tool vet help'. 1790 // For details of a specific checker such as 'printf', see 'go tool vet help printf'. 1791 // 1792 // The -n flag prints commands that would be executed. 1793 // The -x flag prints commands as they are executed. 1794 // 1795 // The -vettool=prog flag selects a different analysis tool with alternative 1796 // or additional checks. 1797 // For example, the 'shadow' analyzer can be built and run using these commands: 1798 // 1799 // go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow 1800 // go vet -vettool=$(which shadow) 1801 // 1802 // The build flags supported by go vet are those that control package resolution 1803 // and execution, such as -n, -x, -v, -tags, and -toolexec. 1804 // For more about these flags, see 'go help build'. 1805 // 1806 // See also: go fmt, go fix. 1807 // 1808 // 1809 // Build constraints 1810 // 1811 // A build constraint, also known as a build tag, is a line comment that begins 1812 // 1813 // //go:build 1814 // 1815 // that lists the conditions under which a file should be included in the package. 1816 // Constraints may appear in any kind of source file (not just Go), but 1817 // they must appear near the top of the file, preceded 1818 // only by blank lines and other line comments. These rules mean that in Go 1819 // files a build constraint must appear before the package clause. 1820 // 1821 // To distinguish build constraints from package documentation, 1822 // a build constraint should be followed by a blank line. 1823 // 1824 // A build constraint is evaluated as an expression containing options 1825 // combined by ||, &&, and ! operators and parentheses. Operators have 1826 // the same meaning as in Go. 1827 // 1828 // For example, the following build constraint constrains a file to 1829 // build when the "linux" and "386" constraints are satisfied, or when 1830 // "darwin" is satisfied and "cgo" is not: 1831 // 1832 // //go:build (linux && 386) || (darwin && !cgo) 1833 // 1834 // It is an error for a file to have more than one //go:build line. 1835 // 1836 // During a particular build, the following words are satisfied: 1837 // 1838 // - the target operating system, as spelled by runtime.GOOS, set with the 1839 // GOOS environment variable. 1840 // - the target architecture, as spelled by runtime.GOARCH, set with the 1841 // GOARCH environment variable. 1842 // - the compiler being used, either "gc" or "gccgo" 1843 // - "cgo", if the cgo command is supported (see CGO_ENABLED in 1844 // 'go help environment'). 1845 // - a term for each Go major release, through the current version: 1846 // "go1.1" from Go version 1.1 onward, "go1.12" from Go 1.12, and so on. 1847 // - any additional tags given by the -tags flag (see 'go help build'). 1848 // 1849 // There are no separate build tags for beta or minor releases. 1850 // 1851 // If a file's name, after stripping the extension and a possible _test suffix, 1852 // matches any of the following patterns: 1853 // *_GOOS 1854 // *_GOARCH 1855 // *_GOOS_GOARCH 1856 // (example: source_windows_amd64.go) where GOOS and GOARCH represent 1857 // any known operating system and architecture values respectively, then 1858 // the file is considered to have an implicit build constraint requiring 1859 // those terms (in addition to any explicit constraints in the file). 1860 // 1861 // Using GOOS=android matches build tags and files as for GOOS=linux 1862 // in addition to android tags and files. 1863 // 1864 // Using GOOS=illumos matches build tags and files as for GOOS=solaris 1865 // in addition to illumos tags and files. 1866 // 1867 // Using GOOS=ios matches build tags and files as for GOOS=darwin 1868 // in addition to ios tags and files. 1869 // 1870 // To keep a file from being considered for the build: 1871 // 1872 // //go:build ignore 1873 // 1874 // (any other unsatisfied word will work as well, but "ignore" is conventional.) 1875 // 1876 // To build a file only when using cgo, and only on Linux and OS X: 1877 // 1878 // //go:build cgo && (linux || darwin) 1879 // 1880 // Such a file is usually paired with another file implementing the 1881 // default functionality for other systems, which in this case would 1882 // carry the constraint: 1883 // 1884 // //go:build !(cgo && (linux || darwin)) 1885 // 1886 // Naming a file dns_windows.go will cause it to be included only when 1887 // building the package for Windows; similarly, math_386.s will be included 1888 // only when building the package for 32-bit x86. 1889 // 1890 // Go versions 1.16 and earlier used a different syntax for build constraints, 1891 // with a "// +build" prefix. The gofmt command will add an equivalent //go:build 1892 // constraint when encountering the older syntax. 1893 // 1894 // 1895 // Build modes 1896 // 1897 // The 'go build' and 'go install' commands take a -buildmode argument which 1898 // indicates which kind of object file is to be built. Currently supported values 1899 // are: 1900 // 1901 // -buildmode=archive 1902 // Build the listed non-main packages into .a files. Packages named 1903 // main are ignored. 1904 // 1905 // -buildmode=c-archive 1906 // Build the listed main package, plus all packages it imports, 1907 // into a C archive file. The only callable symbols will be those 1908 // functions exported using a cgo //export comment. Requires 1909 // exactly one main package to be listed. 1910 // 1911 // -buildmode=c-shared 1912 // Build the listed main package, plus all packages it imports, 1913 // into a C shared library. The only callable symbols will 1914 // be those functions exported using a cgo //export comment. 1915 // Requires exactly one main package to be listed. 1916 // 1917 // -buildmode=default 1918 // Listed main packages are built into executables and listed 1919 // non-main packages are built into .a files (the default 1920 // behavior). 1921 // 1922 // -buildmode=shared 1923 // Combine all the listed non-main packages into a single shared 1924 // library that will be used when building with the -linkshared 1925 // option. Packages named main are ignored. 1926 // 1927 // -buildmode=exe 1928 // Build the listed main packages and everything they import into 1929 // executables. Packages not named main are ignored. 1930 // 1931 // -buildmode=pie 1932 // Build the listed main packages and everything they import into 1933 // position independent executables (PIE). Packages not named 1934 // main are ignored. 1935 // 1936 // -buildmode=plugin 1937 // Build the listed main packages, plus all packages that they 1938 // import, into a Go plugin. Packages not named main are ignored. 1939 // 1940 // On AIX, when linking a C program that uses a Go archive built with 1941 // -buildmode=c-archive, you must pass -Wl,-bnoobjreorder to the C compiler. 1942 // 1943 // 1944 // Calling between Go and C 1945 // 1946 // There are two different ways to call between Go and C/C++ code. 1947 // 1948 // The first is the cgo tool, which is part of the Go distribution. For 1949 // information on how to use it see the cgo documentation (go doc cmd/cgo). 1950 // 1951 // The second is the SWIG program, which is a general tool for 1952 // interfacing between languages. For information on SWIG see 1953 // http://swig.org/. When running go build, any file with a .swig 1954 // extension will be passed to SWIG. Any file with a .swigcxx extension 1955 // will be passed to SWIG with the -c++ option. 1956 // 1957 // When either cgo or SWIG is used, go build will pass any .c, .m, .s, .S 1958 // or .sx files to the C compiler, and any .cc, .cpp, .cxx files to the C++ 1959 // compiler. The CC or CXX environment variables may be set to determine 1960 // the C or C++ compiler, respectively, to use. 1961 // 1962 // 1963 // Build and test caching 1964 // 1965 // The go command caches build outputs for reuse in future builds. 1966 // The default location for cache data is a subdirectory named go-build 1967 // in the standard user cache directory for the current operating system. 1968 // Setting the GOCACHE environment variable overrides this default, 1969 // and running 'go env GOCACHE' prints the current cache directory. 1970 // 1971 // The go command periodically deletes cached data that has not been 1972 // used recently. Running 'go clean -cache' deletes all cached data. 1973 // 1974 // The build cache correctly accounts for changes to Go source files, 1975 // compilers, compiler options, and so on: cleaning the cache explicitly 1976 // should not be necessary in typical use. However, the build cache 1977 // does not detect changes to C libraries imported with cgo. 1978 // If you have made changes to the C libraries on your system, you 1979 // will need to clean the cache explicitly or else use the -a build flag 1980 // (see 'go help build') to force rebuilding of packages that 1981 // depend on the updated C libraries. 1982 // 1983 // The go command also caches successful package test results. 1984 // See 'go help test' for details. Running 'go clean -testcache' removes 1985 // all cached test results (but not cached build results). 1986 // 1987 // The go command also caches values used in fuzzing with 'go test -fuzz', 1988 // specifically, values that expanded code coverage when passed to a 1989 // fuzz function. These values are not used for regular building and 1990 // testing, but they're stored in a subdirectory of the build cache. 1991 // Running 'go clean -fuzzcache' removes all cached fuzzing values. 1992 // This may make fuzzing less effective, temporarily. 1993 // 1994 // The GODEBUG environment variable can enable printing of debugging 1995 // information about the state of the cache: 1996 // 1997 // GODEBUG=gocacheverify=1 causes the go command to bypass the 1998 // use of any cache entries and instead rebuild everything and check 1999 // that the results match existing cache entries. 2000 // 2001 // GODEBUG=gocachehash=1 causes the go command to print the inputs 2002 // for all of the content hashes it uses to construct cache lookup keys. 2003 // The output is voluminous but can be useful for debugging the cache. 2004 // 2005 // GODEBUG=gocachetest=1 causes the go command to print details of its 2006 // decisions about whether to reuse a cached test result. 2007 // 2008 // 2009 // Environment variables 2010 // 2011 // The go command and the tools it invokes consult environment variables 2012 // for configuration. If an environment variable is unset, the go command 2013 // uses a sensible default setting. To see the effective setting of the 2014 // variable <NAME>, run 'go env <NAME>'. To change the default setting, 2015 // run 'go env -w <NAME>=<VALUE>'. Defaults changed using 'go env -w' 2016 // are recorded in a Go environment configuration file stored in the 2017 // per-user configuration directory, as reported by os.UserConfigDir. 2018 // The location of the configuration file can be changed by setting 2019 // the environment variable GOENV, and 'go env GOENV' prints the 2020 // effective location, but 'go env -w' cannot change the default location. 2021 // See 'go help env' for details. 2022 // 2023 // General-purpose environment variables: 2024 // 2025 // GO111MODULE 2026 // Controls whether the go command runs in module-aware mode or GOPATH mode. 2027 // May be "off", "on", or "auto". 2028 // See https://golang.org/ref/mod#mod-commands. 2029 // GCCGO 2030 // The gccgo command to run for 'go build -compiler=gccgo'. 2031 // GOARCH 2032 // The architecture, or processor, for which to compile code. 2033 // Examples are amd64, 386, arm, ppc64. 2034 // GOBIN 2035 // The directory where 'go install' will install a command. 2036 // GOCACHE 2037 // The directory where the go command will store cached 2038 // information for reuse in future builds. 2039 // GOMODCACHE 2040 // The directory where the go command will store downloaded modules. 2041 // GODEBUG 2042 // Enable various debugging facilities. See 'go doc runtime' 2043 // for details. 2044 // GOENV 2045 // The location of the Go environment configuration file. 2046 // Cannot be set using 'go env -w'. 2047 // Setting GOENV=off in the environment disables the use of the 2048 // default configuration file. 2049 // GOFLAGS 2050 // A space-separated list of -flag=value settings to apply 2051 // to go commands by default, when the given flag is known by 2052 // the current command. Each entry must be a standalone flag. 2053 // Because the entries are space-separated, flag values must 2054 // not contain spaces. Flags listed on the command line 2055 // are applied after this list and therefore override it. 2056 // GOINSECURE 2057 // Comma-separated list of glob patterns (in the syntax of Go's path.Match) 2058 // of module path prefixes that should always be fetched in an insecure 2059 // manner. Only applies to dependencies that are being fetched directly. 2060 // GOINSECURE does not disable checksum database validation. GOPRIVATE or 2061 // GONOSUMDB may be used to achieve that. 2062 // GOOS 2063 // The operating system for which to compile code. 2064 // Examples are linux, darwin, windows, netbsd. 2065 // GOPATH 2066 // For more details see: 'go help gopath'. 2067 // GOPROXY 2068 // URL of Go module proxy. See https://golang.org/ref/mod#environment-variables 2069 // and https://golang.org/ref/mod#module-proxy for details. 2070 // GOPRIVATE, GONOPROXY, GONOSUMDB 2071 // Comma-separated list of glob patterns (in the syntax of Go's path.Match) 2072 // of module path prefixes that should always be fetched directly 2073 // or that should not be compared against the checksum database. 2074 // See https://golang.org/ref/mod#private-modules. 2075 // GOROOT 2076 // The root of the go tree. 2077 // GOSUMDB 2078 // The name of checksum database to use and optionally its public key and 2079 // URL. See https://golang.org/ref/mod#authenticating. 2080 // GOTMPDIR 2081 // The directory where the go command will write 2082 // temporary source files, packages, and binaries. 2083 // GOVCS 2084 // Lists version control commands that may be used with matching servers. 2085 // See 'go help vcs'. 2086 // GOWORK 2087 // In module aware mode, use the given go.work file as a workspace file. 2088 // By default or when GOWORK is "auto", the go command searches for a 2089 // file named go.work in the current directory and then containing directories 2090 // until one is found. If a valid go.work file is found, the modules 2091 // specified will collectively be used as the main modules. If GOWORK 2092 // is "off", or a go.work file is not found in "auto" mode, workspace 2093 // mode is disabled. 2094 // 2095 // Environment variables for use with cgo: 2096 // 2097 // AR 2098 // The command to use to manipulate library archives when 2099 // building with the gccgo compiler. 2100 // The default is 'ar'. 2101 // CC 2102 // The command to use to compile C code. 2103 // CGO_ENABLED 2104 // Whether the cgo command is supported. Either 0 or 1. 2105 // CGO_CFLAGS 2106 // Flags that cgo will pass to the compiler when compiling 2107 // C code. 2108 // CGO_CFLAGS_ALLOW 2109 // A regular expression specifying additional flags to allow 2110 // to appear in #cgo CFLAGS source code directives. 2111 // Does not apply to the CGO_CFLAGS environment variable. 2112 // CGO_CFLAGS_DISALLOW 2113 // A regular expression specifying flags that must be disallowed 2114 // from appearing in #cgo CFLAGS source code directives. 2115 // Does not apply to the CGO_CFLAGS environment variable. 2116 // CGO_CPPFLAGS, CGO_CPPFLAGS_ALLOW, CGO_CPPFLAGS_DISALLOW 2117 // Like CGO_CFLAGS, CGO_CFLAGS_ALLOW, and CGO_CFLAGS_DISALLOW, 2118 // but for the C preprocessor. 2119 // CGO_CXXFLAGS, CGO_CXXFLAGS_ALLOW, CGO_CXXFLAGS_DISALLOW 2120 // Like CGO_CFLAGS, CGO_CFLAGS_ALLOW, and CGO_CFLAGS_DISALLOW, 2121 // but for the C++ compiler. 2122 // CGO_FFLAGS, CGO_FFLAGS_ALLOW, CGO_FFLAGS_DISALLOW 2123 // Like CGO_CFLAGS, CGO_CFLAGS_ALLOW, and CGO_CFLAGS_DISALLOW, 2124 // but for the Fortran compiler. 2125 // CGO_LDFLAGS, CGO_LDFLAGS_ALLOW, CGO_LDFLAGS_DISALLOW 2126 // Like CGO_CFLAGS, CGO_CFLAGS_ALLOW, and CGO_CFLAGS_DISALLOW, 2127 // but for the linker. 2128 // CXX 2129 // The command to use to compile C++ code. 2130 // FC 2131 // The command to use to compile Fortran code. 2132 // PKG_CONFIG 2133 // Path to pkg-config tool. 2134 // 2135 // Architecture-specific environment variables: 2136 // 2137 // GOARM 2138 // For GOARCH=arm, the ARM architecture for which to compile. 2139 // Valid values are 5, 6, 7. 2140 // GO386 2141 // For GOARCH=386, how to implement floating point instructions. 2142 // Valid values are sse2 (default), softfloat. 2143 // GOAMD64 2144 // For GOARCH=amd64, the microarchitecture level for which to compile. 2145 // Valid values are v1 (default), v2, v3, v4. 2146 // See https://golang.org/wiki/MinimumRequirements#amd64 2147 // GOMIPS 2148 // For GOARCH=mips{,le}, whether to use floating point instructions. 2149 // Valid values are hardfloat (default), softfloat. 2150 // GOMIPS64 2151 // For GOARCH=mips64{,le}, whether to use floating point instructions. 2152 // Valid values are hardfloat (default), softfloat. 2153 // GOPPC64 2154 // For GOARCH=ppc64{,le}, the target ISA (Instruction Set Architecture). 2155 // Valid values are power8 (default), power9. 2156 // GOWASM 2157 // For GOARCH=wasm, comma-separated list of experimental WebAssembly features to use. 2158 // Valid values are satconv, signext. 2159 // 2160 // Special-purpose environment variables: 2161 // 2162 // GCCGOTOOLDIR 2163 // If set, where to find gccgo tools, such as cgo. 2164 // The default is based on how gccgo was configured. 2165 // GOEXPERIMENT 2166 // Comma-separated list of toolchain experiments to enable or disable. 2167 // The list of available experiments may change arbitrarily over time. 2168 // See src/internal/goexperiment/flags.go for currently valid values. 2169 // Warning: This variable is provided for the development and testing 2170 // of the Go toolchain itself. Use beyond that purpose is unsupported. 2171 // GOROOT_FINAL 2172 // The root of the installed Go tree, when it is 2173 // installed in a location other than where it is built. 2174 // File names in stack traces are rewritten from GOROOT to 2175 // GOROOT_FINAL. 2176 // GO_EXTLINK_ENABLED 2177 // Whether the linker should use external linking mode 2178 // when using -linkmode=auto with code that uses cgo. 2179 // Set to 0 to disable external linking mode, 1 to enable it. 2180 // GIT_ALLOW_PROTOCOL 2181 // Defined by Git. A colon-separated list of schemes that are allowed 2182 // to be used with git fetch/clone. If set, any scheme not explicitly 2183 // mentioned will be considered insecure by 'go get'. 2184 // Because the variable is defined by Git, the default value cannot 2185 // be set using 'go env -w'. 2186 // 2187 // Additional information available from 'go env' but not read from the environment: 2188 // 2189 // GOEXE 2190 // The executable file name suffix (".exe" on Windows, "" on other systems). 2191 // GOGCCFLAGS 2192 // A space-separated list of arguments supplied to the CC command. 2193 // GOHOSTARCH 2194 // The architecture (GOARCH) of the Go toolchain binaries. 2195 // GOHOSTOS 2196 // The operating system (GOOS) of the Go toolchain binaries. 2197 // GOMOD 2198 // The absolute path to the go.mod of the main module. 2199 // If module-aware mode is enabled, but there is no go.mod, GOMOD will be 2200 // os.DevNull ("/dev/null" on Unix-like systems, "NUL" on Windows). 2201 // If module-aware mode is disabled, GOMOD will be the empty string. 2202 // GOTOOLDIR 2203 // The directory where the go tools (compile, cover, doc, etc...) are installed. 2204 // GOVERSION 2205 // The version of the installed Go tree, as reported by runtime.Version. 2206 // 2207 // 2208 // File types 2209 // 2210 // The go command examines the contents of a restricted set of files 2211 // in each directory. It identifies which files to examine based on 2212 // the extension of the file name. These extensions are: 2213 // 2214 // .go 2215 // Go source files. 2216 // .c, .h 2217 // C source files. 2218 // If the package uses cgo or SWIG, these will be compiled with the 2219 // OS-native compiler (typically gcc); otherwise they will 2220 // trigger an error. 2221 // .cc, .cpp, .cxx, .hh, .hpp, .hxx 2222 // C++ source files. Only useful with cgo or SWIG, and always 2223 // compiled with the OS-native compiler. 2224 // .m 2225 // Objective-C source files. Only useful with cgo, and always 2226 // compiled with the OS-native compiler. 2227 // .s, .S, .sx 2228 // Assembler source files. 2229 // If the package uses cgo or SWIG, these will be assembled with the 2230 // OS-native assembler (typically gcc (sic)); otherwise they 2231 // will be assembled with the Go assembler. 2232 // .swig, .swigcxx 2233 // SWIG definition files. 2234 // .syso 2235 // System object files. 2236 // 2237 // Files of each of these types except .syso may contain build 2238 // constraints, but the go command stops scanning for build constraints 2239 // at the first item in the file that is not a blank line or //-style 2240 // line comment. See the go/build package documentation for 2241 // more details. 2242 // 2243 // 2244 // The go.mod file 2245 // 2246 // A module version is defined by a tree of source files, with a go.mod 2247 // file in its root. When the go command is run, it looks in the current 2248 // directory and then successive parent directories to find the go.mod 2249 // marking the root of the main (current) module. 2250 // 2251 // The go.mod file format is described in detail at 2252 // https://golang.org/ref/mod#go-mod-file. 2253 // 2254 // To create a new go.mod file, use 'go mod init'. For details see 2255 // 'go help mod init' or https://golang.org/ref/mod#go-mod-init. 2256 // 2257 // To add missing module requirements or remove unneeded requirements, 2258 // use 'go mod tidy'. For details, see 'go help mod tidy' or 2259 // https://golang.org/ref/mod#go-mod-tidy. 2260 // 2261 // To add, upgrade, downgrade, or remove a specific module requirement, use 2262 // 'go get'. For details, see 'go help module-get' or 2263 // https://golang.org/ref/mod#go-get. 2264 // 2265 // To make other changes or to parse go.mod as JSON for use by other tools, 2266 // use 'go mod edit'. See 'go help mod edit' or 2267 // https://golang.org/ref/mod#go-mod-edit. 2268 // 2269 // 2270 // GOPATH environment variable 2271 // 2272 // The Go path is used to resolve import statements. 2273 // It is implemented by and documented in the go/build package. 2274 // 2275 // The GOPATH environment variable lists places to look for Go code. 2276 // On Unix, the value is a colon-separated string. 2277 // On Windows, the value is a semicolon-separated string. 2278 // On Plan 9, the value is a list. 2279 // 2280 // If the environment variable is unset, GOPATH defaults 2281 // to a subdirectory named "go" in the user's home directory 2282 // ($HOME/go on Unix, %USERPROFILE%\go on Windows), 2283 // unless that directory holds a Go distribution. 2284 // Run "go env GOPATH" to see the current GOPATH. 2285 // 2286 // See https://golang.org/wiki/SettingGOPATH to set a custom GOPATH. 2287 // 2288 // Each directory listed in GOPATH must have a prescribed structure: 2289 // 2290 // The src directory holds source code. The path below src 2291 // determines the import path or executable name. 2292 // 2293 // The pkg directory holds installed package objects. 2294 // As in the Go tree, each target operating system and 2295 // architecture pair has its own subdirectory of pkg 2296 // (pkg/GOOS_GOARCH). 2297 // 2298 // If DIR is a directory listed in the GOPATH, a package with 2299 // source in DIR/src/foo/bar can be imported as "foo/bar" and 2300 // has its compiled form installed to "DIR/pkg/GOOS_GOARCH/foo/bar.a". 2301 // 2302 // The bin directory holds compiled commands. 2303 // Each command is named for its source directory, but only 2304 // the final element, not the entire path. That is, the 2305 // command with source in DIR/src/foo/quux is installed into 2306 // DIR/bin/quux, not DIR/bin/foo/quux. The "foo/" prefix is stripped 2307 // so that you can add DIR/bin to your PATH to get at the 2308 // installed commands. If the GOBIN environment variable is 2309 // set, commands are installed to the directory it names instead 2310 // of DIR/bin. GOBIN must be an absolute path. 2311 // 2312 // Here's an example directory layout: 2313 // 2314 // GOPATH=/home/user/go 2315 // 2316 // /home/user/go/ 2317 // src/ 2318 // foo/ 2319 // bar/ (go code in package bar) 2320 // x.go 2321 // quux/ (go code in package main) 2322 // y.go 2323 // bin/ 2324 // quux (installed command) 2325 // pkg/ 2326 // linux_amd64/ 2327 // foo/ 2328 // bar.a (installed package object) 2329 // 2330 // Go searches each directory listed in GOPATH to find source code, 2331 // but new packages are always downloaded into the first directory 2332 // in the list. 2333 // 2334 // See https://golang.org/doc/code.html for an example. 2335 // 2336 // GOPATH and Modules 2337 // 2338 // When using modules, GOPATH is no longer used for resolving imports. 2339 // However, it is still used to store downloaded source code (in GOPATH/pkg/mod) 2340 // and compiled commands (in GOPATH/bin). 2341 // 2342 // Internal Directories 2343 // 2344 // Code in or below a directory named "internal" is importable only 2345 // by code in the directory tree rooted at the parent of "internal". 2346 // Here's an extended version of the directory layout above: 2347 // 2348 // /home/user/go/ 2349 // src/ 2350 // crash/ 2351 // bang/ (go code in package bang) 2352 // b.go 2353 // foo/ (go code in package foo) 2354 // f.go 2355 // bar/ (go code in package bar) 2356 // x.go 2357 // internal/ 2358 // baz/ (go code in package baz) 2359 // z.go 2360 // quux/ (go code in package main) 2361 // y.go 2362 // 2363 // 2364 // The code in z.go is imported as "foo/internal/baz", but that 2365 // import statement can only appear in source files in the subtree 2366 // rooted at foo. The source files foo/f.go, foo/bar/x.go, and 2367 // foo/quux/y.go can all import "foo/internal/baz", but the source file 2368 // crash/bang/b.go cannot. 2369 // 2370 // See https://golang.org/s/go14internal for details. 2371 // 2372 // Vendor Directories 2373 // 2374 // Go 1.6 includes support for using local copies of external dependencies 2375 // to satisfy imports of those dependencies, often referred to as vendoring. 2376 // 2377 // Code below a directory named "vendor" is importable only 2378 // by code in the directory tree rooted at the parent of "vendor", 2379 // and only using an import path that omits the prefix up to and 2380 // including the vendor element. 2381 // 2382 // Here's the example from the previous section, 2383 // but with the "internal" directory renamed to "vendor" 2384 // and a new foo/vendor/crash/bang directory added: 2385 // 2386 // /home/user/go/ 2387 // src/ 2388 // crash/ 2389 // bang/ (go code in package bang) 2390 // b.go 2391 // foo/ (go code in package foo) 2392 // f.go 2393 // bar/ (go code in package bar) 2394 // x.go 2395 // vendor/ 2396 // crash/ 2397 // bang/ (go code in package bang) 2398 // b.go 2399 // baz/ (go code in package baz) 2400 // z.go 2401 // quux/ (go code in package main) 2402 // y.go 2403 // 2404 // The same visibility rules apply as for internal, but the code 2405 // in z.go is imported as "baz", not as "foo/vendor/baz". 2406 // 2407 // Code in vendor directories deeper in the source tree shadows 2408 // code in higher directories. Within the subtree rooted at foo, an import 2409 // of "crash/bang" resolves to "foo/vendor/crash/bang", not the 2410 // top-level "crash/bang". 2411 // 2412 // Code in vendor directories is not subject to import path 2413 // checking (see 'go help importpath'). 2414 // 2415 // When 'go get' checks out or updates a git repository, it now also 2416 // updates submodules. 2417 // 2418 // Vendor directories do not affect the placement of new repositories 2419 // being checked out for the first time by 'go get': those are always 2420 // placed in the main GOPATH, never in a vendor subtree. 2421 // 2422 // See https://golang.org/s/go15vendor for details. 2423 // 2424 // 2425 // Legacy GOPATH go get 2426 // 2427 // The 'go get' command changes behavior depending on whether the 2428 // go command is running in module-aware mode or legacy GOPATH mode. 2429 // This help text, accessible as 'go help gopath-get' even in module-aware mode, 2430 // describes 'go get' as it operates in legacy GOPATH mode. 2431 // 2432 // Usage: go get [-d] [-f] [-t] [-u] [-v] [-fix] [build flags] [packages] 2433 // 2434 // Get downloads the packages named by the import paths, along with their 2435 // dependencies. It then installs the named packages, like 'go install'. 2436 // 2437 // The -d flag instructs get to stop after downloading the packages; that is, 2438 // it instructs get not to install the packages. 2439 // 2440 // The -f flag, valid only when -u is set, forces get -u not to verify that 2441 // each package has been checked out from the source control repository 2442 // implied by its import path. This can be useful if the source is a local fork 2443 // of the original. 2444 // 2445 // The -fix flag instructs get to run the fix tool on the downloaded packages 2446 // before resolving dependencies or building the code. 2447 // 2448 // The -t flag instructs get to also download the packages required to build 2449 // the tests for the specified packages. 2450 // 2451 // The -u flag instructs get to use the network to update the named packages 2452 // and their dependencies. By default, get uses the network to check out 2453 // missing packages but does not use it to look for updates to existing packages. 2454 // 2455 // The -v flag enables verbose progress and debug output. 2456 // 2457 // Get also accepts build flags to control the installation. See 'go help build'. 2458 // 2459 // When checking out a new package, get creates the target directory 2460 // GOPATH/src/<import-path>. If the GOPATH contains multiple entries, 2461 // get uses the first one. For more details see: 'go help gopath'. 2462 // 2463 // When checking out or updating a package, get looks for a branch or tag 2464 // that matches the locally installed version of Go. The most important 2465 // rule is that if the local installation is running version "go1", get 2466 // searches for a branch or tag named "go1". If no such version exists 2467 // it retrieves the default branch of the package. 2468 // 2469 // When go get checks out or updates a Git repository, 2470 // it also updates any git submodules referenced by the repository. 2471 // 2472 // Get never checks out or updates code stored in vendor directories. 2473 // 2474 // For more about specifying packages, see 'go help packages'. 2475 // 2476 // For more about how 'go get' finds source code to 2477 // download, see 'go help importpath'. 2478 // 2479 // This text describes the behavior of get when using GOPATH 2480 // to manage source code and dependencies. 2481 // If instead the go command is running in module-aware mode, 2482 // the details of get's flags and effects change, as does 'go help get'. 2483 // See 'go help modules' and 'go help module-get'. 2484 // 2485 // See also: go build, go install, go clean. 2486 // 2487 // 2488 // Module proxy protocol 2489 // 2490 // A Go module proxy is any web server that can respond to GET requests for 2491 // URLs of a specified form. The requests have no query parameters, so even 2492 // a site serving from a fixed file system (including a file:/// URL) 2493 // can be a module proxy. 2494 // 2495 // For details on the GOPROXY protocol, see 2496 // https://golang.org/ref/mod#goproxy-protocol. 2497 // 2498 // 2499 // Import path syntax 2500 // 2501 // An import path (see 'go help packages') denotes a package stored in the local 2502 // file system. In general, an import path denotes either a standard package (such 2503 // as "unicode/utf8") or a package found in one of the work spaces (For more 2504 // details see: 'go help gopath'). 2505 // 2506 // Relative import paths 2507 // 2508 // An import path beginning with ./ or ../ is called a relative path. 2509 // The toolchain supports relative import paths as a shortcut in two ways. 2510 // 2511 // First, a relative path can be used as a shorthand on the command line. 2512 // If you are working in the directory containing the code imported as 2513 // "unicode" and want to run the tests for "unicode/utf8", you can type 2514 // "go test ./utf8" instead of needing to specify the full path. 2515 // Similarly, in the reverse situation, "go test .." will test "unicode" from 2516 // the "unicode/utf8" directory. Relative patterns are also allowed, like 2517 // "go test ./..." to test all subdirectories. See 'go help packages' for details 2518 // on the pattern syntax. 2519 // 2520 // Second, if you are compiling a Go program not in a work space, 2521 // you can use a relative path in an import statement in that program 2522 // to refer to nearby code also not in a work space. 2523 // This makes it easy to experiment with small multipackage programs 2524 // outside of the usual work spaces, but such programs cannot be 2525 // installed with "go install" (there is no work space in which to install them), 2526 // so they are rebuilt from scratch each time they are built. 2527 // To avoid ambiguity, Go programs cannot use relative import paths 2528 // within a work space. 2529 // 2530 // Remote import paths 2531 // 2532 // Certain import paths also 2533 // describe how to obtain the source code for the package using 2534 // a revision control system. 2535 // 2536 // A few common code hosting sites have special syntax: 2537 // 2538 // Bitbucket (Git, Mercurial) 2539 // 2540 // import "bitbucket.org/user/project" 2541 // import "bitbucket.org/user/project/sub/directory" 2542 // 2543 // GitHub (Git) 2544 // 2545 // import "github.com/user/project" 2546 // import "github.com/user/project/sub/directory" 2547 // 2548 // Launchpad (Bazaar) 2549 // 2550 // import "launchpad.net/project" 2551 // import "launchpad.net/project/series" 2552 // import "launchpad.net/project/series/sub/directory" 2553 // 2554 // import "launchpad.net/~user/project/branch" 2555 // import "launchpad.net/~user/project/branch/sub/directory" 2556 // 2557 // IBM DevOps Services (Git) 2558 // 2559 // import "hub.jazz.net/git/user/project" 2560 // import "hub.jazz.net/git/user/project/sub/directory" 2561 // 2562 // For code hosted on other servers, import paths may either be qualified 2563 // with the version control type, or the go tool can dynamically fetch 2564 // the import path over https/http and discover where the code resides 2565 // from a <meta> tag in the HTML. 2566 // 2567 // To declare the code location, an import path of the form 2568 // 2569 // repository.vcs/path 2570 // 2571 // specifies the given repository, with or without the .vcs suffix, 2572 // using the named version control system, and then the path inside 2573 // that repository. The supported version control systems are: 2574 // 2575 // Bazaar .bzr 2576 // Fossil .fossil 2577 // Git .git 2578 // Mercurial .hg 2579 // Subversion .svn 2580 // 2581 // For example, 2582 // 2583 // import "example.org/user/foo.hg" 2584 // 2585 // denotes the root directory of the Mercurial repository at 2586 // example.org/user/foo or foo.hg, and 2587 // 2588 // import "example.org/repo.git/foo/bar" 2589 // 2590 // denotes the foo/bar directory of the Git repository at 2591 // example.org/repo or repo.git. 2592 // 2593 // When a version control system supports multiple protocols, 2594 // each is tried in turn when downloading. For example, a Git 2595 // download tries https://, then git+ssh://. 2596 // 2597 // By default, downloads are restricted to known secure protocols 2598 // (e.g. https, ssh). To override this setting for Git downloads, the 2599 // GIT_ALLOW_PROTOCOL environment variable can be set (For more details see: 2600 // 'go help environment'). 2601 // 2602 // If the import path is not a known code hosting site and also lacks a 2603 // version control qualifier, the go tool attempts to fetch the import 2604 // over https/http and looks for a <meta> tag in the document's HTML 2605 // <head>. 2606 // 2607 // The meta tag has the form: 2608 // 2609 // <meta name="go-import" content="import-prefix vcs repo-root"> 2610 // 2611 // The import-prefix is the import path corresponding to the repository 2612 // root. It must be a prefix or an exact match of the package being 2613 // fetched with "go get". If it's not an exact match, another http 2614 // request is made at the prefix to verify the <meta> tags match. 2615 // 2616 // The meta tag should appear as early in the file as possible. 2617 // In particular, it should appear before any raw JavaScript or CSS, 2618 // to avoid confusing the go command's restricted parser. 2619 // 2620 // The vcs is one of "bzr", "fossil", "git", "hg", "svn". 2621 // 2622 // The repo-root is the root of the version control system 2623 // containing a scheme and not containing a .vcs qualifier. 2624 // 2625 // For example, 2626 // 2627 // import "example.org/pkg/foo" 2628 // 2629 // will result in the following requests: 2630 // 2631 // https://example.org/pkg/foo?go-get=1 (preferred) 2632 // http://example.org/pkg/foo?go-get=1 (fallback, only with use of correctly set GOINSECURE) 2633 // 2634 // If that page contains the meta tag 2635 // 2636 // <meta name="go-import" content="example.org git https://code.org/r/p/exproj"> 2637 // 2638 // the go tool will verify that https://example.org/?go-get=1 contains the 2639 // same meta tag and then git clone https://code.org/r/p/exproj into 2640 // GOPATH/src/example.org. 2641 // 2642 // When using GOPATH, downloaded packages are written to the first directory 2643 // listed in the GOPATH environment variable. 2644 // (See 'go help gopath-get' and 'go help gopath'.) 2645 // 2646 // When using modules, downloaded packages are stored in the module cache. 2647 // See https://golang.org/ref/mod#module-cache. 2648 // 2649 // When using modules, an additional variant of the go-import meta tag is 2650 // recognized and is preferred over those listing version control systems. 2651 // That variant uses "mod" as the vcs in the content value, as in: 2652 // 2653 // <meta name="go-import" content="example.org mod https://code.org/moduleproxy"> 2654 // 2655 // This tag means to fetch modules with paths beginning with example.org 2656 // from the module proxy available at the URL https://code.org/moduleproxy. 2657 // See https://golang.org/ref/mod#goproxy-protocol for details about the 2658 // proxy protocol. 2659 // 2660 // Import path checking 2661 // 2662 // When the custom import path feature described above redirects to a 2663 // known code hosting site, each of the resulting packages has two possible 2664 // import paths, using the custom domain or the known hosting site. 2665 // 2666 // A package statement is said to have an "import comment" if it is immediately 2667 // followed (before the next newline) by a comment of one of these two forms: 2668 // 2669 // package math // import "path" 2670 // package math /* import "path" */ 2671 // 2672 // The go command will refuse to install a package with an import comment 2673 // unless it is being referred to by that import path. In this way, import comments 2674 // let package authors make sure the custom import path is used and not a 2675 // direct path to the underlying code hosting site. 2676 // 2677 // Import path checking is disabled for code found within vendor trees. 2678 // This makes it possible to copy code into alternate locations in vendor trees 2679 // without needing to update import comments. 2680 // 2681 // Import path checking is also disabled when using modules. 2682 // Import path comments are obsoleted by the go.mod file's module statement. 2683 // 2684 // See https://golang.org/s/go14customimport for details. 2685 // 2686 // 2687 // Modules, module versions, and more 2688 // 2689 // Modules are how Go manages dependencies. 2690 // 2691 // A module is a collection of packages that are released, versioned, and 2692 // distributed together. Modules may be downloaded directly from version control 2693 // repositories or from module proxy servers. 2694 // 2695 // For a series of tutorials on modules, see 2696 // https://golang.org/doc/tutorial/create-module. 2697 // 2698 // For a detailed reference on modules, see https://golang.org/ref/mod. 2699 // 2700 // By default, the go command may download modules from https://proxy.golang.org. 2701 // It may authenticate modules using the checksum database at 2702 // https://sum.golang.org. Both services are operated by the Go team at Google. 2703 // The privacy policies for these services are available at 2704 // https://proxy.golang.org/privacy and https://sum.golang.org/privacy, 2705 // respectively. 2706 // 2707 // The go command's download behavior may be configured using GOPROXY, GOSUMDB, 2708 // GOPRIVATE, and other environment variables. See 'go help environment' 2709 // and https://golang.org/ref/mod#private-module-privacy for more information. 2710 // 2711 // 2712 // Module authentication using go.sum 2713 // 2714 // When the go command downloads a module zip file or go.mod file into the 2715 // module cache, it computes a cryptographic hash and compares it with a known 2716 // value to verify the file hasn't changed since it was first downloaded. Known 2717 // hashes are stored in a file in the module root directory named go.sum. Hashes 2718 // may also be downloaded from the checksum database depending on the values of 2719 // GOSUMDB, GOPRIVATE, and GONOSUMDB. 2720 // 2721 // For details, see https://golang.org/ref/mod#authenticating. 2722 // 2723 // 2724 // Package lists and patterns 2725 // 2726 // Many commands apply to a set of packages: 2727 // 2728 // go action [packages] 2729 // 2730 // Usually, [packages] is a list of import paths. 2731 // 2732 // An import path that is a rooted path or that begins with 2733 // a . or .. element is interpreted as a file system path and 2734 // denotes the package in that directory. 2735 // 2736 // Otherwise, the import path P denotes the package found in 2737 // the directory DIR/src/P for some DIR listed in the GOPATH 2738 // environment variable (For more details see: 'go help gopath'). 2739 // 2740 // If no import paths are given, the action applies to the 2741 // package in the current directory. 2742 // 2743 // There are four reserved names for paths that should not be used 2744 // for packages to be built with the go tool: 2745 // 2746 // - "main" denotes the top-level package in a stand-alone executable. 2747 // 2748 // - "all" expands to all packages found in all the GOPATH 2749 // trees. For example, 'go list all' lists all the packages on the local 2750 // system. When using modules, "all" expands to all packages in 2751 // the main module and their dependencies, including dependencies 2752 // needed by tests of any of those. 2753 // 2754 // - "std" is like all but expands to just the packages in the standard 2755 // Go library. 2756 // 2757 // - "cmd" expands to the Go repository's commands and their 2758 // internal libraries. 2759 // 2760 // Import paths beginning with "cmd/" only match source code in 2761 // the Go repository. 2762 // 2763 // An import path is a pattern if it includes one or more "..." wildcards, 2764 // each of which can match any string, including the empty string and 2765 // strings containing slashes. Such a pattern expands to all package 2766 // directories found in the GOPATH trees with names matching the 2767 // patterns. 2768 // 2769 // To make common patterns more convenient, there are two special cases. 2770 // First, /... at the end of the pattern can match an empty string, 2771 // so that net/... matches both net and packages in its subdirectories, like net/http. 2772 // Second, any slash-separated pattern element containing a wildcard never 2773 // participates in a match of the "vendor" element in the path of a vendored 2774 // package, so that ./... does not match packages in subdirectories of 2775 // ./vendor or ./mycode/vendor, but ./vendor/... and ./mycode/vendor/... do. 2776 // Note, however, that a directory named vendor that itself contains code 2777 // is not a vendored package: cmd/vendor would be a command named vendor, 2778 // and the pattern cmd/... matches it. 2779 // See golang.org/s/go15vendor for more about vendoring. 2780 // 2781 // An import path can also name a package to be downloaded from 2782 // a remote repository. Run 'go help importpath' for details. 2783 // 2784 // Every package in a program must have a unique import path. 2785 // By convention, this is arranged by starting each path with a 2786 // unique prefix that belongs to you. For example, paths used 2787 // internally at Google all begin with 'google', and paths 2788 // denoting remote repositories begin with the path to the code, 2789 // such as 'github.com/user/repo'. 2790 // 2791 // Packages in a program need not have unique package names, 2792 // but there are two reserved package names with special meaning. 2793 // The name main indicates a command, not a library. 2794 // Commands are built into binaries and cannot be imported. 2795 // The name documentation indicates documentation for 2796 // a non-Go program in the directory. Files in package documentation 2797 // are ignored by the go command. 2798 // 2799 // As a special case, if the package list is a list of .go files from a 2800 // single directory, the command is applied to a single synthesized 2801 // package made up of exactly those files, ignoring any build constraints 2802 // in those files and ignoring any other files in the directory. 2803 // 2804 // Directory and file names that begin with "." or "_" are ignored 2805 // by the go tool, as are directories named "testdata". 2806 // 2807 // 2808 // Configuration for downloading non-public code 2809 // 2810 // The go command defaults to downloading modules from the public Go module 2811 // mirror at proxy.golang.org. It also defaults to validating downloaded modules, 2812 // regardless of source, against the public Go checksum database at sum.golang.org. 2813 // These defaults work well for publicly available source code. 2814 // 2815 // The GOPRIVATE environment variable controls which modules the go command 2816 // considers to be private (not available publicly) and should therefore not use 2817 // the proxy or checksum database. The variable is a comma-separated list of 2818 // glob patterns (in the syntax of Go's path.Match) of module path prefixes. 2819 // For example, 2820 // 2821 // GOPRIVATE=*.corp.example.com,rsc.io/private 2822 // 2823 // causes the go command to treat as private any module with a path prefix 2824 // matching either pattern, including git.corp.example.com/xyzzy, rsc.io/private, 2825 // and rsc.io/private/quux. 2826 // 2827 // For fine-grained control over module download and validation, the GONOPROXY 2828 // and GONOSUMDB environment variables accept the same kind of glob list 2829 // and override GOPRIVATE for the specific decision of whether to use the proxy 2830 // and checksum database, respectively. 2831 // 2832 // For example, if a company ran a module proxy serving private modules, 2833 // users would configure go using: 2834 // 2835 // GOPRIVATE=*.corp.example.com 2836 // GOPROXY=proxy.example.com 2837 // GONOPROXY=none 2838 // 2839 // The GOPRIVATE variable is also used to define the "public" and "private" 2840 // patterns for the GOVCS variable; see 'go help vcs'. For that usage, 2841 // GOPRIVATE applies even in GOPATH mode. In that case, it matches import paths 2842 // instead of module paths. 2843 // 2844 // The 'go env -w' command (see 'go help env') can be used to set these variables 2845 // for future go command invocations. 2846 // 2847 // For more details, see https://golang.org/ref/mod#private-modules. 2848 // 2849 // 2850 // Testing flags 2851 // 2852 // The 'go test' command takes both flags that apply to 'go test' itself 2853 // and flags that apply to the resulting test binary. 2854 // 2855 // Several of the flags control profiling and write an execution profile 2856 // suitable for "go tool pprof"; run "go tool pprof -h" for more 2857 // information. The --alloc_space, --alloc_objects, and --show_bytes 2858 // options of pprof control how the information is presented. 2859 // 2860 // The following flags are recognized by the 'go test' command and 2861 // control the execution of any test: 2862 // 2863 // -bench regexp 2864 // Run only those benchmarks matching a regular expression. 2865 // By default, no benchmarks are run. 2866 // To run all benchmarks, use '-bench .' or '-bench=.'. 2867 // The regular expression is split by unbracketed slash (/) 2868 // characters into a sequence of regular expressions, and each 2869 // part of a benchmark's identifier must match the corresponding 2870 // element in the sequence, if any. Possible parents of matches 2871 // are run with b.N=1 to identify sub-benchmarks. For example, 2872 // given -bench=X/Y, top-level benchmarks matching X are run 2873 // with b.N=1 to find any sub-benchmarks matching Y, which are 2874 // then run in full. 2875 // 2876 // -benchtime t 2877 // Run enough iterations of each benchmark to take t, specified 2878 // as a time.Duration (for example, -benchtime 1h30s). 2879 // The default is 1 second (1s). 2880 // The special syntax Nx means to run the benchmark N times 2881 // (for example, -benchtime 100x). 2882 // 2883 // -count n 2884 // Run each test, benchmark, and fuzz seed n times (default 1). 2885 // If -cpu is set, run n times for each GOMAXPROCS value. 2886 // Examples are always run once. -count does not apply to 2887 // fuzz tests matched by -fuzz. 2888 // 2889 // -cover 2890 // Enable coverage analysis. 2891 // Note that because coverage works by annotating the source 2892 // code before compilation, compilation and test failures with 2893 // coverage enabled may report line numbers that don't correspond 2894 // to the original sources. 2895 // 2896 // -covermode set,count,atomic 2897 // Set the mode for coverage analysis for the package[s] 2898 // being tested. The default is "set" unless -race is enabled, 2899 // in which case it is "atomic". 2900 // The values: 2901 // set: bool: does this statement run? 2902 // count: int: how many times does this statement run? 2903 // atomic: int: count, but correct in multithreaded tests; 2904 // significantly more expensive. 2905 // Sets -cover. 2906 // 2907 // -coverpkg pattern1,pattern2,pattern3 2908 // Apply coverage analysis in each test to packages matching the patterns. 2909 // The default is for each test to analyze only the package being tested. 2910 // See 'go help packages' for a description of package patterns. 2911 // Sets -cover. 2912 // 2913 // -cpu 1,2,4 2914 // Specify a list of GOMAXPROCS values for which the tests, benchmarks or 2915 // fuzz tests should be executed. The default is the current value 2916 // of GOMAXPROCS. -cpu does not apply to fuzz tests matched by -fuzz. 2917 // 2918 // -failfast 2919 // Do not start new tests after the first test failure. 2920 // 2921 // -fuzz regexp 2922 // Run the fuzz test matching the regular expression. When specified, 2923 // the command line argument must match exactly one package within the 2924 // main module, and regexp must match exactly one fuzz test within 2925 // that package. Fuzzing will occur after tests, benchmarks, seed corpora 2926 // of other fuzz tests, and examples have completed. See the Fuzzing 2927 // section of the testing package documentation for details. 2928 // 2929 // -fuzztime t 2930 // Run enough iterations of the fuzz target during fuzzing to take t, 2931 // specified as a time.Duration (for example, -fuzztime 1h30s). 2932 // The default is to run forever. 2933 // The special syntax Nx means to run the fuzz target N times 2934 // (for example, -fuzztime 1000x). 2935 // 2936 // -fuzzminimizetime t 2937 // Run enough iterations of the fuzz target during each minimization 2938 // attempt to take t, as specified as a time.Duration (for example, 2939 // -fuzzminimizetime 30s). 2940 // The default is 60s. 2941 // The special syntax Nx means to run the fuzz target N times 2942 // (for example, -fuzzminimizetime 100x). 2943 // 2944 // -json 2945 // Log verbose output and test results in JSON. This presents the 2946 // same information as the -v flag in a machine-readable format. 2947 // 2948 // -list regexp 2949 // List tests, benchmarks, fuzz tests, or examples matching the regular 2950 // expression. No tests, benchmarks, fuzz tests, or examples will be run. 2951 // This will only list top-level tests. No subtest or subbenchmarks will be 2952 // shown. 2953 // 2954 // -parallel n 2955 // Allow parallel execution of test functions that call t.Parallel, and 2956 // fuzz targets that call t.Parallel when running the seed corpus. 2957 // The value of this flag is the maximum number of tests to run 2958 // simultaneously. 2959 // While fuzzing, the value of this flag is the maximum number of 2960 // subprocesses that may call the fuzz function simultaneously, regardless of 2961 // whether T.Parallel is called. 2962 // By default, -parallel is set to the value of GOMAXPROCS. 2963 // Setting -parallel to values higher than GOMAXPROCS may cause degraded 2964 // performance due to CPU contention, especially when fuzzing. 2965 // Note that -parallel only applies within a single test binary. 2966 // The 'go test' command may run tests for different packages 2967 // in parallel as well, according to the setting of the -p flag 2968 // (see 'go help build'). 2969 // 2970 // -run regexp 2971 // Run only those tests, examples, and fuzz tests matching the regular 2972 // expression. For tests, the regular expression is split by unbracketed 2973 // slash (/) characters into a sequence of regular expressions, and each 2974 // part of a test's identifier must match the corresponding element in 2975 // the sequence, if any. Note that possible parents of matches are 2976 // run too, so that -run=X/Y matches and runs and reports the result 2977 // of all tests matching X, even those without sub-tests matching Y, 2978 // because it must run them to look for those sub-tests. 2979 // 2980 // -short 2981 // Tell long-running tests to shorten their run time. 2982 // It is off by default but set during all.bash so that installing 2983 // the Go tree can run a sanity check but not spend time running 2984 // exhaustive tests. 2985 // 2986 // -shuffle off,on,N 2987 // Randomize the execution order of tests and benchmarks. 2988 // It is off by default. If -shuffle is set to on, then it will seed 2989 // the randomizer using the system clock. If -shuffle is set to an 2990 // integer N, then N will be used as the seed value. In both cases, 2991 // the seed will be reported for reproducibility. 2992 // 2993 // -timeout d 2994 // If a test binary runs longer than duration d, panic. 2995 // If d is 0, the timeout is disabled. 2996 // The default is 10 minutes (10m). 2997 // 2998 // -v 2999 // Verbose output: log all tests as they are run. Also print all 3000 // text from Log and Logf calls even if the test succeeds. 3001 // 3002 // -vet list 3003 // Configure the invocation of "go vet" during "go test" 3004 // to use the comma-separated list of vet checks. 3005 // If list is empty, "go test" runs "go vet" with a curated list of 3006 // checks believed to be always worth addressing. 3007 // If list is "off", "go test" does not run "go vet" at all. 3008 // 3009 // The following flags are also recognized by 'go test' and can be used to 3010 // profile the tests during execution: 3011 // 3012 // -benchmem 3013 // Print memory allocation statistics for benchmarks. 3014 // 3015 // -blockprofile block.out 3016 // Write a goroutine blocking profile to the specified file 3017 // when all tests are complete. 3018 // Writes test binary as -c would. 3019 // 3020 // -blockprofilerate n 3021 // Control the detail provided in goroutine blocking profiles by 3022 // calling runtime.SetBlockProfileRate with n. 3023 // See 'go doc runtime.SetBlockProfileRate'. 3024 // The profiler aims to sample, on average, one blocking event every 3025 // n nanoseconds the program spends blocked. By default, 3026 // if -test.blockprofile is set without this flag, all blocking events 3027 // are recorded, equivalent to -test.blockprofilerate=1. 3028 // 3029 // -coverprofile cover.out 3030 // Write a coverage profile to the file after all tests have passed. 3031 // Sets -cover. 3032 // 3033 // -cpuprofile cpu.out 3034 // Write a CPU profile to the specified file before exiting. 3035 // Writes test binary as -c would. 3036 // 3037 // -memprofile mem.out 3038 // Write an allocation profile to the file after all tests have passed. 3039 // Writes test binary as -c would. 3040 // 3041 // -memprofilerate n 3042 // Enable more precise (and expensive) memory allocation profiles by 3043 // setting runtime.MemProfileRate. See 'go doc runtime.MemProfileRate'. 3044 // To profile all memory allocations, use -test.memprofilerate=1. 3045 // 3046 // -mutexprofile mutex.out 3047 // Write a mutex contention profile to the specified file 3048 // when all tests are complete. 3049 // Writes test binary as -c would. 3050 // 3051 // -mutexprofilefraction n 3052 // Sample 1 in n stack traces of goroutines holding a 3053 // contended mutex. 3054 // 3055 // -outputdir directory 3056 // Place output files from profiling in the specified directory, 3057 // by default the directory in which "go test" is running. 3058 // 3059 // -trace trace.out 3060 // Write an execution trace to the specified file before exiting. 3061 // 3062 // Each of these flags is also recognized with an optional 'test.' prefix, 3063 // as in -test.v. When invoking the generated test binary (the result of 3064 // 'go test -c') directly, however, the prefix is mandatory. 3065 // 3066 // The 'go test' command rewrites or removes recognized flags, 3067 // as appropriate, both before and after the optional package list, 3068 // before invoking the test binary. 3069 // 3070 // For instance, the command 3071 // 3072 // go test -v -myflag testdata -cpuprofile=prof.out -x 3073 // 3074 // will compile the test binary and then run it as 3075 // 3076 // pkg.test -test.v -myflag testdata -test.cpuprofile=prof.out 3077 // 3078 // (The -x flag is removed because it applies only to the go command's 3079 // execution, not to the test itself.) 3080 // 3081 // The test flags that generate profiles (other than for coverage) also 3082 // leave the test binary in pkg.test for use when analyzing the profiles. 3083 // 3084 // When 'go test' runs a test binary, it does so from within the 3085 // corresponding package's source code directory. Depending on the test, 3086 // it may be necessary to do the same when invoking a generated test 3087 // binary directly. Because that directory may be located within the 3088 // module cache, which may be read-only and is verified by checksums, the 3089 // test must not write to it or any other directory within the module 3090 // unless explicitly requested by the user (such as with the -fuzz flag, 3091 // which writes failures to testdata/fuzz). 3092 // 3093 // The command-line package list, if present, must appear before any 3094 // flag not known to the go test command. Continuing the example above, 3095 // the package list would have to appear before -myflag, but could appear 3096 // on either side of -v. 3097 // 3098 // When 'go test' runs in package list mode, 'go test' caches successful 3099 // package test results to avoid unnecessary repeated running of tests. To 3100 // disable test caching, use any test flag or argument other than the 3101 // cacheable flags. The idiomatic way to disable test caching explicitly 3102 // is to use -count=1. 3103 // 3104 // To keep an argument for a test binary from being interpreted as a 3105 // known flag or a package name, use -args (see 'go help test') which 3106 // passes the remainder of the command line through to the test binary 3107 // uninterpreted and unaltered. 3108 // 3109 // For instance, the command 3110 // 3111 // go test -v -args -x -v 3112 // 3113 // will compile the test binary and then run it as 3114 // 3115 // pkg.test -test.v -x -v 3116 // 3117 // Similarly, 3118 // 3119 // go test -args math 3120 // 3121 // will compile the test binary and then run it as 3122 // 3123 // pkg.test math 3124 // 3125 // In the first example, the -x and the second -v are passed through to the 3126 // test binary unchanged and with no effect on the go command itself. 3127 // In the second example, the argument math is passed through to the test 3128 // binary, instead of being interpreted as the package list. 3129 // 3130 // 3131 // Testing functions 3132 // 3133 // The 'go test' command expects to find test, benchmark, and example functions 3134 // in the "*_test.go" files corresponding to the package under test. 3135 // 3136 // A test function is one named TestXxx (where Xxx does not start with a 3137 // lower case letter) and should have the signature, 3138 // 3139 // func TestXxx(t *testing.T) { ... } 3140 // 3141 // A benchmark function is one named BenchmarkXxx and should have the signature, 3142 // 3143 // func BenchmarkXxx(b *testing.B) { ... } 3144 // 3145 // A fuzz test is one named FuzzXxx and should have the signature, 3146 // 3147 // func FuzzXxx(f *testing.F) { ... } 3148 // 3149 // An example function is similar to a test function but, instead of using 3150 // *testing.T to report success or failure, prints output to os.Stdout. 3151 // If the last comment in the function starts with "Output:" then the output 3152 // is compared exactly against the comment (see examples below). If the last 3153 // comment begins with "Unordered output:" then the output is compared to the 3154 // comment, however the order of the lines is ignored. An example with no such 3155 // comment is compiled but not executed. An example with no text after 3156 // "Output:" is compiled, executed, and expected to produce no output. 3157 // 3158 // Godoc displays the body of ExampleXxx to demonstrate the use 3159 // of the function, constant, or variable Xxx. An example of a method M with 3160 // receiver type T or *T is named ExampleT_M. There may be multiple examples 3161 // for a given function, constant, or variable, distinguished by a trailing _xxx, 3162 // where xxx is a suffix not beginning with an upper case letter. 3163 // 3164 // Here is an example of an example: 3165 // 3166 // func ExamplePrintln() { 3167 // Println("The output of\nthis example.") 3168 // // Output: The output of 3169 // // this example. 3170 // } 3171 // 3172 // Here is another example where the ordering of the output is ignored: 3173 // 3174 // func ExamplePerm() { 3175 // for _, value := range Perm(4) { 3176 // fmt.Println(value) 3177 // } 3178 // 3179 // // Unordered output: 4 3180 // // 2 3181 // // 1 3182 // // 3 3183 // // 0 3184 // } 3185 // 3186 // The entire test file is presented as the example when it contains a single 3187 // example function, at least one other function, type, variable, or constant 3188 // declaration, and no tests, benchmarks, or fuzz tests. 3189 // 3190 // See the documentation of the testing package for more information. 3191 // 3192 // 3193 // Controlling version control with GOVCS 3194 // 3195 // The 'go get' command can run version control commands like git 3196 // to download imported code. This functionality is critical to the decentralized 3197 // Go package ecosystem, in which code can be imported from any server, 3198 // but it is also a potential security problem, if a malicious server finds a 3199 // way to cause the invoked version control command to run unintended code. 3200 // 3201 // To balance the functionality and security concerns, the 'go get' command 3202 // by default will only use git and hg to download code from public servers. 3203 // But it will use any known version control system (bzr, fossil, git, hg, svn) 3204 // to download code from private servers, defined as those hosting packages 3205 // matching the GOPRIVATE variable (see 'go help private'). The rationale behind 3206 // allowing only Git and Mercurial is that these two systems have had the most 3207 // attention to issues of being run as clients of untrusted servers. In contrast, 3208 // Bazaar, Fossil, and Subversion have primarily been used in trusted, 3209 // authenticated environments and are not as well scrutinized as attack surfaces. 3210 // 3211 // The version control command restrictions only apply when using direct version 3212 // control access to download code. When downloading modules from a proxy, 3213 // 'go get' uses the proxy protocol instead, which is always permitted. 3214 // By default, the 'go get' command uses the Go module mirror (proxy.golang.org) 3215 // for public packages and only falls back to version control for private 3216 // packages or when the mirror refuses to serve a public package (typically for 3217 // legal reasons). Therefore, clients can still access public code served from 3218 // Bazaar, Fossil, or Subversion repositories by default, because those downloads 3219 // use the Go module mirror, which takes on the security risk of running the 3220 // version control commands using a custom sandbox. 3221 // 3222 // The GOVCS variable can be used to change the allowed version control systems 3223 // for specific packages (identified by a module or import path). 3224 // The GOVCS variable applies when building package in both module-aware mode 3225 // and GOPATH mode. When using modules, the patterns match against the module path. 3226 // When using GOPATH, the patterns match against the import path corresponding to 3227 // the root of the version control repository. 3228 // 3229 // The general form of the GOVCS setting is a comma-separated list of 3230 // pattern:vcslist rules. The pattern is a glob pattern that must match 3231 // one or more leading elements of the module or import path. The vcslist 3232 // is a pipe-separated list of allowed version control commands, or "all" 3233 // to allow use of any known command, or "off" to disallow all commands. 3234 // Note that if a module matches a pattern with vcslist "off", it may still be 3235 // downloaded if the origin server uses the "mod" scheme, which instructs the 3236 // go command to download the module using the GOPROXY protocol. 3237 // The earliest matching pattern in the list applies, even if later patterns 3238 // might also match. 3239 // 3240 // For example, consider: 3241 // 3242 // GOVCS=github.com:git,evil.com:off,*:git|hg 3243 // 3244 // With this setting, code with a module or import path beginning with 3245 // github.com/ can only use git; paths on evil.com cannot use any version 3246 // control command, and all other paths (* matches everything) can use 3247 // only git or hg. 3248 // 3249 // The special patterns "public" and "private" match public and private 3250 // module or import paths. A path is private if it matches the GOPRIVATE 3251 // variable; otherwise it is public. 3252 // 3253 // If no rules in the GOVCS variable match a particular module or import path, 3254 // the 'go get' command applies its default rule, which can now be summarized 3255 // in GOVCS notation as 'public:git|hg,private:all'. 3256 // 3257 // To allow unfettered use of any version control system for any package, use: 3258 // 3259 // GOVCS=*:all 3260 // 3261 // To disable all use of version control, use: 3262 // 3263 // GOVCS=*:off 3264 // 3265 // The 'go env -w' command (see 'go help env') can be used to set the GOVCS 3266 // variable for future go command invocations. 3267 // 3268 // 3269 package main 3270