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