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