github.com/mdempsky/go@v0.0.0-20151201204031-5dd372bd1e70/src/cmd/go/alldocs.go (about) 1 // Copyright 2011 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // DO NOT EDIT THIS FILE. GENERATED BY mkalldocs.sh. 6 // Edit the documentation in other files and rerun mkalldocs.sh to generate this one. 7 8 /* 9 Go is a tool for managing Go source code. 10 11 Usage: 12 13 go command [arguments] 14 15 The commands are: 16 17 build compile packages and dependencies 18 clean remove object files 19 doc show documentation for package or symbol 20 env print Go environment information 21 fix run go tool fix on packages 22 fmt run gofmt on package sources 23 generate generate Go files by processing source 24 get download and install packages and dependencies 25 install compile and install packages and dependencies 26 list list packages 27 run compile and run Go program 28 test test packages 29 tool run specified go tool 30 version print Go version 31 vet run go tool vet on packages 32 33 Use "go help [command]" for more information about a command. 34 35 Additional help topics: 36 37 c calling between Go and C 38 buildmode description of build modes 39 filetype file types 40 gopath GOPATH environment variable 41 environment environment variables 42 importpath import path syntax 43 packages description of package lists 44 testflag description of testing flags 45 testfunc description of testing functions 46 47 Use "go help [topic]" for more information about that topic. 48 49 50 Compile packages and dependencies 51 52 Usage: 53 54 go build [-o output] [-i] [build flags] [packages] 55 56 Build compiles the packages named by the import paths, 57 along with their dependencies, but it does not install the results. 58 59 If the arguments to build are a list of .go files, build treats 60 them as a list of source files specifying a single package. 61 62 When compiling a single main package, build writes 63 the resulting executable to an output file named after 64 the first source file ('go build ed.go rx.go' writes 'ed' or 'ed.exe') 65 or the source code directory ('go build unix/sam' writes 'sam' or 'sam.exe'). 66 The '.exe' suffix is added when writing a Windows executable. 67 68 When compiling multiple packages or a single non-main package, 69 build compiles the packages but discards the resulting object, 70 serving only as a check that the packages can be built. 71 72 The -o flag, only allowed when compiling a single package, 73 forces build to write the resulting executable or object 74 to the named output file, instead of the default behavior described 75 in the last two paragraphs. 76 77 The -i flag installs the packages that are dependencies of the target. 78 79 The build flags are shared by the build, clean, get, install, list, run, 80 and test commands: 81 82 -a 83 force rebuilding of packages that are already up-to-date. 84 -n 85 print the commands but do not run them. 86 -p n 87 the number of builds that can be run in parallel. 88 The default is the number of CPUs available, except 89 on darwin/arm which defaults to 1. 90 -race 91 enable data race detection. 92 Supported only on linux/amd64, freebsd/amd64, darwin/amd64 and windows/amd64. 93 -msan 94 enable interoperation with memory sanitizer. 95 Supported only on linux/amd64. 96 -v 97 print the names of packages as they are compiled. 98 -work 99 print the name of the temporary work directory and 100 do not delete it when exiting. 101 -x 102 print the commands. 103 104 -asmflags 'flag list' 105 arguments to pass on each go tool asm invocation. 106 -buildmode mode 107 build mode to use. See 'go help buildmode' for more. 108 -compiler name 109 name of compiler to use, as in runtime.Compiler (gccgo or gc). 110 -gccgoflags 'arg list' 111 arguments to pass on each gccgo compiler/linker invocation. 112 -gcflags 'arg list' 113 arguments to pass on each go tool compile invocation. 114 -installsuffix suffix 115 a suffix to use in the name of the package installation directory, 116 in order to keep output separate from default builds. 117 If using the -race flag, the install suffix is automatically set to race 118 or, if set explicitly, has _race appended to it. Likewise for the -msan 119 flag. Using a -buildmode option that requires non-default compile flags 120 has a similar effect. 121 -ldflags 'flag list' 122 arguments to pass on each go tool link invocation. 123 -linkshared 124 link against shared libraries previously created with 125 -buildmode=shared. 126 -pkgdir dir 127 install and load all packages from dir instead of the usual locations. 128 For example, when building with a non-standard configuration, 129 use -pkgdir to keep generated packages in a separate location. 130 -tags 'tag list' 131 a list of build tags to consider satisfied during the build. 132 For more information about build tags, see the description of 133 build constraints in the documentation for the go/build package. 134 -toolexec 'cmd args' 135 a program to use to invoke toolchain programs like vet and asm. 136 For example, instead of running asm, the go command will run 137 'cmd args /path/to/asm <arguments for asm>'. 138 139 The list flags accept a space-separated list of strings. To embed spaces 140 in an element in the list, surround it with either single or double quotes. 141 142 For more about specifying packages, see 'go help packages'. 143 For more about where packages and binaries are installed, 144 run 'go help gopath'. 145 For more about calling between Go and C/C++, run 'go help c'. 146 147 Note: Build adheres to certain conventions such as those described 148 by 'go help gopath'. Not all projects can follow these conventions, 149 however. Installations that have their own conventions or that use 150 a separate software build system may choose to use lower-level 151 invocations such as 'go tool compile' and 'go tool link' to avoid 152 some of the overheads and design decisions of the build tool. 153 154 See also: go install, go get, go clean. 155 156 157 Remove object files 158 159 Usage: 160 161 go clean [-i] [-r] [-n] [-x] [build flags] [packages] 162 163 Clean removes object files from package source directories. 164 The go command builds most objects in a temporary directory, 165 so go clean is mainly concerned with object files left by other 166 tools or by manual invocations of go build. 167 168 Specifically, clean removes the following files from each of the 169 source directories corresponding to the import paths: 170 171 _obj/ old object directory, left from Makefiles 172 _test/ old test directory, left from Makefiles 173 _testmain.go old gotest file, left from Makefiles 174 test.out old test log, left from Makefiles 175 build.out old test log, left from Makefiles 176 *.[568ao] object files, left from Makefiles 177 178 DIR(.exe) from go build 179 DIR.test(.exe) from go test -c 180 MAINFILE(.exe) from go build MAINFILE.go 181 *.so from SWIG 182 183 In the list, DIR represents the final path element of the 184 directory, and MAINFILE is the base name of any Go source 185 file in the directory that is not included when building 186 the package. 187 188 The -i flag causes clean to remove the corresponding installed 189 archive or binary (what 'go install' would create). 190 191 The -n flag causes clean to print the remove commands it would execute, 192 but not run them. 193 194 The -r flag causes clean to be applied recursively to all the 195 dependencies of the packages named by the import paths. 196 197 The -x flag causes clean to print remove commands as it executes them. 198 199 For more about build flags, see 'go help build'. 200 201 For more about specifying packages, see 'go help packages'. 202 203 204 Show documentation for package or symbol 205 206 Usage: 207 208 go doc [-u] [-c] [package|[package.]symbol[.method]] 209 210 Doc prints the documentation comments associated with the item identified by its 211 arguments (a package, const, func, type, var, or method) followed by a one-line 212 summary of each of the first-level items "under" that item (package-level 213 declarations for a package, methods for a type, etc.). 214 215 Doc accepts zero, one, or two arguments. 216 217 Given no arguments, that is, when run as 218 219 go doc 220 221 it prints the package documentation for the package in the current directory. 222 If the package is a command (package main), the exported symbols of the package 223 are elided from the presentation unless the -cmd flag is provided. 224 225 When run with one argument, the argument is treated as a Go-syntax-like 226 representation of the item to be documented. What the argument selects depends 227 on what is installed in GOROOT and GOPATH, as well as the form of the argument, 228 which is schematically one of these: 229 230 go doc <pkg> 231 go doc <sym>[.<method>] 232 go doc [<pkg>.]<sym>[.<method>] 233 go doc [<pkg>.][<sym>.]<method> 234 235 The first item in this list matched by the argument is the one whose documentation 236 is printed. (See the examples below.) However, if the argument starts with a capital 237 letter it is assumed to identify a symbol or method in the current directory. 238 239 For packages, the order of scanning is determined lexically, but the GOROOT tree 240 is always scanned before GOPATH. 241 242 If there is no package specified or matched, the package in the current 243 directory is selected, so "go doc Foo" shows the documentation for symbol Foo in 244 the current package. 245 246 The package path must be either a qualified path or a proper suffix of a 247 path. The go tool's usual package mechanism does not apply: package path 248 elements like . and ... are not implemented by go doc. 249 250 When run with two arguments, the first must be a full package path (not just a 251 suffix), and the second is a symbol or symbol and method; this is similar to the 252 syntax accepted by godoc: 253 254 go doc <pkg> <sym>[.<method>] 255 256 In all forms, when matching symbols, lower-case letters in the argument match 257 either case but upper-case letters match exactly. This means that there may be 258 multiple matches of a lower-case argument in a package if different symbols have 259 different cases. If this occurs, documentation for all matches is printed. 260 261 Examples: 262 go doc 263 Show documentation for current package. 264 go doc Foo 265 Show documentation for Foo in the current package. 266 (Foo starts with a capital letter so it cannot match 267 a package path.) 268 go doc encoding/json 269 Show documentation for the encoding/json package. 270 go doc json 271 Shorthand for encoding/json. 272 go doc json.Number (or go doc json.number) 273 Show documentation and method summary for json.Number. 274 go doc json.Number.Int64 (or go doc json.number.int64) 275 Show documentation for json.Number's Int64 method. 276 go doc cmd/doc 277 Show package docs for the doc command. 278 go doc -cmd cmd/doc 279 Show package docs and exported symbols within the doc command. 280 go doc template.new 281 Show documentation for html/template's New function. 282 (html/template is lexically before text/template) 283 go doc text/template.new # One argument 284 Show documentation for text/template's New function. 285 go doc text/template new # Two arguments 286 Show documentation for text/template's New function. 287 288 At least in the current tree, these invocations all print the 289 documentation for json.Decoder's Decode method: 290 291 go doc json.Decoder.Decode 292 go doc json.decoder.decode 293 go doc json.decode 294 cd go/src/encoding/json; go doc decode 295 296 Flags: 297 -c 298 Respect case when matching symbols. 299 -cmd 300 Treat a command (package main) like a regular package. 301 Otherwise package main's exported symbols are hidden 302 when showing the package's top-level documentation. 303 -u 304 Show documentation for unexported as well as exported 305 symbols and methods. 306 307 308 Print Go environment information 309 310 Usage: 311 312 go env [var ...] 313 314 Env prints Go environment information. 315 316 By default env prints information as a shell script 317 (on Windows, a batch file). If one or more variable 318 names is given as arguments, env prints the value of 319 each named variable on its own line. 320 321 322 Run go tool fix on packages 323 324 Usage: 325 326 go fix [packages] 327 328 Fix runs the Go fix command on the packages named by the import paths. 329 330 For more about fix, see 'go doc cmd/fix'. 331 For more about specifying packages, see 'go help packages'. 332 333 To run fix with specific options, run 'go tool fix'. 334 335 See also: go fmt, go vet. 336 337 338 Run gofmt on package sources 339 340 Usage: 341 342 go fmt [-n] [-x] [packages] 343 344 Fmt runs the command 'gofmt -l -w' on the packages named 345 by the import paths. It prints the names of the files that are modified. 346 347 For more about gofmt, see 'go doc cmd/gofmt'. 348 For more about specifying packages, see 'go help packages'. 349 350 The -n flag prints commands that would be executed. 351 The -x flag prints commands as they are executed. 352 353 To run gofmt with specific options, run gofmt itself. 354 355 See also: go fix, go vet. 356 357 358 Generate Go files by processing source 359 360 Usage: 361 362 go generate [-run regexp] [file.go... | packages] 363 364 Generate runs commands described by directives within existing 365 files. Those commands can run any process but the intent is to 366 create or update Go source files, for instance by running yacc. 367 368 Go generate is never run automatically by go build, go get, go test, 369 and so on. It must be run explicitly. 370 371 Go generate scans the file for directives, which are lines of 372 the form, 373 374 //go:generate command argument... 375 376 (note: no leading spaces and no space in "//go") where command 377 is the generator to be run, corresponding to an executable file 378 that can be run locally. It must either be in the shell path 379 (gofmt), a fully qualified path (/usr/you/bin/mytool), or a 380 command alias, described below. 381 382 Note that go generate does not parse the file, so lines that look 383 like directives in comments or multiline strings will be treated 384 as directives. 385 386 The arguments to the directive are space-separated tokens or 387 double-quoted strings passed to the generator as individual 388 arguments when it is run. 389 390 Quoted strings use Go syntax and are evaluated before execution; a 391 quoted string appears as a single argument to the generator. 392 393 Go generate sets several variables when it runs the generator: 394 395 $GOARCH 396 The execution architecture (arm, amd64, etc.) 397 $GOOS 398 The execution operating system (linux, windows, etc.) 399 $GOFILE 400 The base name of the file. 401 $GOLINE 402 The line number of the directive in the source file. 403 $GOPACKAGE 404 The name of the package of the file containing the directive. 405 $DOLLAR 406 A dollar sign. 407 408 Other than variable substitution and quoted-string evaluation, no 409 special processing such as "globbing" is performed on the command 410 line. 411 412 As a last step before running the command, any invocations of any 413 environment variables with alphanumeric names, such as $GOFILE or 414 $HOME, are expanded throughout the command line. The syntax for 415 variable expansion is $NAME on all operating systems. Due to the 416 order of evaluation, variables are expanded even inside quoted 417 strings. If the variable NAME is not set, $NAME expands to the 418 empty string. 419 420 A directive of the form, 421 422 //go:generate -command xxx args... 423 424 specifies, for the remainder of this source file only, that the 425 string xxx represents the command identified by the arguments. This 426 can be used to create aliases or to handle multiword generators. 427 For example, 428 429 //go:generate -command yacc go tool yacc 430 431 specifies that the command "yacc" represents the generator 432 "go tool yacc". 433 434 Generate processes packages in the order given on the command line, 435 one at a time. If the command line lists .go files, they are treated 436 as a single package. Within a package, generate processes the 437 source files in a package in file name order, one at a time. Within 438 a source file, generate runs generators in the order they appear 439 in the file, one at a time. 440 441 If any generator returns an error exit status, "go generate" skips 442 all further processing for that package. 443 444 The generator is run in the package's source directory. 445 446 Go generate accepts one specific flag: 447 448 -run="" 449 if non-empty, specifies a regular expression to select 450 directives whose full original source text (excluding 451 any trailing spaces and final newline) matches the 452 expression. 453 454 It also accepts the standard build flags including -v, -n, and -x. 455 The -v flag prints the names of packages and files as they are 456 processed. 457 The -n flag prints commands that would be executed. 458 The -x flag prints commands as they are executed. 459 460 For more about specifying packages, see 'go help packages'. 461 462 463 Download and install packages and dependencies 464 465 Usage: 466 467 go get [-d] [-f] [-fix] [-insecure] [-t] [-u] [build flags] [packages] 468 469 Get downloads and installs the packages named by the import paths, 470 along with their dependencies. 471 472 The -d flag instructs get to stop after downloading the packages; that is, 473 it instructs get not to install the packages. 474 475 The -f flag, valid only when -u is set, forces get -u not to verify that 476 each package has been checked out from the source control repository 477 implied by its import path. This can be useful if the source is a local fork 478 of the original. 479 480 The -fix flag instructs get to run the fix tool on the downloaded packages 481 before resolving dependencies or building the code. 482 483 The -insecure flag permits fetching from repositories and resolving 484 custom domains using insecure schemes such as HTTP. Use with caution. 485 486 The -t flag instructs get to also download the packages required to build 487 the tests for the specified packages. 488 489 The -u flag instructs get to use the network to update the named packages 490 and their dependencies. By default, get uses the network to check out 491 missing packages but does not use it to look for updates to existing packages. 492 493 Get also accepts build flags to control the installation. See 'go help build'. 494 495 When checking out or updating a package, get looks for a branch or tag 496 that matches the locally installed version of Go. The most important 497 rule is that if the local installation is running version "go1", get 498 searches for a branch or tag named "go1". If no such version exists it 499 retrieves the most recent version of the package. 500 501 Unless vendoring support is disabled (see 'go help gopath'), 502 when go get checks out or updates a Git repository, 503 it also updates any git submodules referenced by the repository. 504 505 For more about specifying packages, see 'go help packages'. 506 507 For more about how 'go get' finds source code to 508 download, see 'go help importpath'. 509 510 See also: go build, go install, go clean. 511 512 513 Compile and install packages and dependencies 514 515 Usage: 516 517 go install [build flags] [packages] 518 519 Install compiles and installs the packages named by the import paths, 520 along with their dependencies. 521 522 For more about the build flags, see 'go help build'. 523 For more about specifying packages, see 'go help packages'. 524 525 See also: go build, go get, go clean. 526 527 528 List packages 529 530 Usage: 531 532 go list [-e] [-f format] [-json] [build flags] [packages] 533 534 List lists the packages named by the import paths, one per line. 535 536 The default output shows the package import path: 537 538 bytes 539 encoding/json 540 github.com/gorilla/mux 541 golang.org/x/net/html 542 543 The -f flag specifies an alternate format for the list, using the 544 syntax of package template. The default output is equivalent to -f 545 '{{.ImportPath}}'. The struct being passed to the template is: 546 547 type Package struct { 548 Dir string // directory containing package sources 549 ImportPath string // import path of package in dir 550 ImportComment string // path in import comment on package statement 551 Name string // package name 552 Doc string // package documentation string 553 Target string // install path 554 Shlib string // the shared library that contains this package (only set when -linkshared) 555 Goroot bool // is this package in the Go root? 556 Standard bool // is this package part of the standard Go library? 557 Stale bool // would 'go install' do anything for this package? 558 Root string // Go root or Go path dir containing this package 559 560 // Source files 561 GoFiles []string // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles) 562 CgoFiles []string // .go sources files that import "C" 563 IgnoredGoFiles []string // .go sources ignored due to build constraints 564 CFiles []string // .c source files 565 CXXFiles []string // .cc, .cxx and .cpp source files 566 MFiles []string // .m source files 567 HFiles []string // .h, .hh, .hpp and .hxx source files 568 SFiles []string // .s source files 569 SwigFiles []string // .swig files 570 SwigCXXFiles []string // .swigcxx files 571 SysoFiles []string // .syso object files to add to archive 572 573 // Cgo directives 574 CgoCFLAGS []string // cgo: flags for C compiler 575 CgoCPPFLAGS []string // cgo: flags for C preprocessor 576 CgoCXXFLAGS []string // cgo: flags for C++ compiler 577 CgoLDFLAGS []string // cgo: flags for linker 578 CgoPkgConfig []string // cgo: pkg-config names 579 580 // Dependency information 581 Imports []string // import paths used by this package 582 Deps []string // all (recursively) imported dependencies 583 584 // Error information 585 Incomplete bool // this package or a dependency has an error 586 Error *PackageError // error loading package 587 DepsErrors []*PackageError // errors loading dependencies 588 589 TestGoFiles []string // _test.go files in package 590 TestImports []string // imports from TestGoFiles 591 XTestGoFiles []string // _test.go files outside package 592 XTestImports []string // imports from XTestGoFiles 593 } 594 595 The template function "join" calls strings.Join. 596 597 The template function "context" returns the build context, defined as: 598 599 type Context struct { 600 GOARCH string // target architecture 601 GOOS string // target operating system 602 GOROOT string // Go root 603 GOPATH string // Go path 604 CgoEnabled bool // whether cgo can be used 605 UseAllFiles bool // use files regardless of +build lines, file names 606 Compiler string // compiler to assume when computing target paths 607 BuildTags []string // build constraints to match in +build lines 608 ReleaseTags []string // releases the current release is compatible with 609 InstallSuffix string // suffix to use in the name of the install dir 610 } 611 612 For more information about the meaning of these fields see the documentation 613 for the go/build package's Context type. 614 615 The -json flag causes the package data to be printed in JSON format 616 instead of using the template format. 617 618 The -e flag changes the handling of erroneous packages, those that 619 cannot be found or are malformed. By default, the list command 620 prints an error to standard error for each erroneous package and 621 omits the packages from consideration during the usual printing. 622 With the -e flag, the list command never prints errors to standard 623 error and instead processes the erroneous packages with the usual 624 printing. Erroneous packages will have a non-empty ImportPath and 625 a non-nil Error field; other information may or may not be missing 626 (zeroed). 627 628 For more about build flags, see 'go help build'. 629 630 For more about specifying packages, see 'go help packages'. 631 632 633 Compile and run Go program 634 635 Usage: 636 637 go run [build flags] [-exec xprog] gofiles... [arguments...] 638 639 Run compiles and runs the main package comprising the named Go source files. 640 A Go source file is defined to be a file ending in a literal ".go" suffix. 641 642 By default, 'go run' runs the compiled binary directly: 'a.out arguments...'. 643 If the -exec flag is given, 'go run' invokes the binary using xprog: 644 'xprog a.out arguments...'. 645 If the -exec flag is not given, GOOS or GOARCH is different from the system 646 default, and a program named go_$GOOS_$GOARCH_exec can be found 647 on the current search path, 'go run' invokes the binary using that program, 648 for example 'go_nacl_386_exec a.out arguments...'. This allows execution of 649 cross-compiled programs when a simulator or other execution method is 650 available. 651 652 For more about build flags, see 'go help build'. 653 654 See also: go build. 655 656 657 Test packages 658 659 Usage: 660 661 go test [-c] [-i] [build and test flags] [packages] [flags for test binary] 662 663 'Go test' automates testing the packages named by the import paths. 664 It prints a summary of the test results in the format: 665 666 ok archive/tar 0.011s 667 FAIL archive/zip 0.022s 668 ok compress/gzip 0.033s 669 ... 670 671 followed by detailed output for each failed package. 672 673 'Go test' recompiles each package along with any files with names matching 674 the file pattern "*_test.go". 675 Files whose names begin with "_" (including "_test.go") or "." are ignored. 676 These additional files can contain test functions, benchmark functions, and 677 example functions. See 'go help testfunc' for more. 678 Each listed package causes the execution of a separate test binary. 679 680 Test files that declare a package with the suffix "_test" will be compiled as a 681 separate package, and then linked and run with the main test binary. 682 683 By default, go test needs no arguments. It compiles and tests the package 684 with source in the current directory, including tests, and runs the tests. 685 686 The package is built in a temporary directory so it does not interfere with the 687 non-test installation. 688 689 In addition to the build flags, the flags handled by 'go test' itself are: 690 691 -c 692 Compile the test binary to pkg.test but do not run it 693 (where pkg is the last element of the package's import path). 694 The file name can be changed with the -o flag. 695 696 -exec xprog 697 Run the test binary using xprog. The behavior is the same as 698 in 'go run'. See 'go help run' for details. 699 700 -i 701 Install packages that are dependencies of the test. 702 Do not run the test. 703 704 -o file 705 Compile the test binary to the named file. 706 The test still runs (unless -c or -i is specified). 707 708 The test binary also accepts flags that control execution of the test; these 709 flags are also accessible by 'go test'. See 'go help testflag' for details. 710 711 If the test binary needs any other flags, they should be presented after the 712 package names. The go tool treats as a flag the first argument that begins with 713 a minus sign that it does not recognize itself; that argument and all subsequent 714 arguments are passed as arguments to the test binary. 715 716 For more about build flags, see 'go help build'. 717 For more about specifying packages, see 'go help packages'. 718 719 See also: go build, go vet. 720 721 722 Run specified go tool 723 724 Usage: 725 726 go tool [-n] command [args...] 727 728 Tool runs the go tool command identified by the arguments. 729 With no arguments it prints the list of known tools. 730 731 The -n flag causes tool to print the command that would be 732 executed but not execute it. 733 734 For more about each tool command, see 'go tool command -h'. 735 736 737 Print Go version 738 739 Usage: 740 741 go version 742 743 Version prints the Go version, as reported by runtime.Version. 744 745 746 Run go tool vet on packages 747 748 Usage: 749 750 go vet [-n] [-x] [build flags] [packages] 751 752 Vet runs the Go vet command on the packages named by the import paths. 753 754 For more about vet, see 'go doc cmd/vet'. 755 For more about specifying packages, see 'go help packages'. 756 757 To run the vet tool with specific options, run 'go tool vet'. 758 759 The -n flag prints commands that would be executed. 760 The -x flag prints commands as they are executed. 761 762 For more about build flags, see 'go help build'. 763 764 See also: go fmt, go fix. 765 766 767 Calling between Go and C 768 769 There are two different ways to call between Go and C/C++ code. 770 771 The first is the cgo tool, which is part of the Go distribution. For 772 information on how to use it see the cgo documentation (go doc cmd/cgo). 773 774 The second is the SWIG program, which is a general tool for 775 interfacing between languages. For information on SWIG see 776 http://swig.org/. When running go build, any file with a .swig 777 extension will be passed to SWIG. Any file with a .swigcxx extension 778 will be passed to SWIG with the -c++ option. 779 780 When either cgo or SWIG is used, go build will pass any .c, .m, .s, 781 or .S files to the C compiler, and any .cc, .cpp, .cxx files to the C++ 782 compiler. The CC or CXX environment variables may be set to determine 783 the C or C++ compiler, respectively, to use. 784 785 786 Description of build modes 787 788 The 'go build' and 'go install' commands take a -buildmode argument which 789 indicates which kind of object file is to be built. Currently supported values 790 are: 791 792 -buildmode=archive 793 Build the listed non-main packages into .a files. Packages named 794 main are ignored. 795 796 -buildmode=c-archive 797 Build the listed main package, plus all packages it imports, 798 into a C archive file. The only callable symbols will be those 799 functions exported using a cgo //export comment. Requires 800 exactly one main package to be listed. 801 802 -buildmode=c-shared 803 Build the listed main packages, plus all packages that they 804 import, into C shared libraries. The only callable symbols will 805 be those functions exported using a cgo //export comment. 806 Non-main packages are ignored. 807 808 -buildmode=default 809 Listed main packages are built into executables and listed 810 non-main packages are built into .a files (the default 811 behavior). 812 813 -buildmode=shared 814 Combine all the listed non-main packages into a single shared 815 library that will be used when building with the -linkshared 816 option. Packages named main are ignored. 817 818 -buildmode=exe 819 Build the listed main packages and everything they import into 820 executables. Packages not named main are ignored. 821 822 -buildmode=pie 823 Build the listed main packages and everything they import into 824 position independent executables (PIE). Packages not named 825 main are ignored. 826 827 828 File types 829 830 The go command examines the contents of a restricted set of files 831 in each directory. It identifies which files to examine based on 832 the extension of the file name. These extensions are: 833 834 .go 835 Go source files. 836 .c, .h 837 C source files. 838 If the package uses cgo or SWIG, these will be compiled with the 839 OS-native compiler (typically gcc); otherwise they will 840 trigger an error. 841 .cc, .cpp, .cxx, .hh, .hpp, .hxx 842 C++ source files. Only useful with cgo or SWIG, and always 843 compiled with the OS-native compiler. 844 .m 845 Objective-C source files. Only useful with cgo, and always 846 compiled with the OS-native compiler. 847 .s, .S 848 Assembler source files. 849 If the package uses cgo or SWIG, these will be assembled with the 850 OS-native assembler (typically gcc (sic)); otherwise they 851 will be assembled with the Go assembler. 852 .swig, .swigcxx 853 SWIG definition files. 854 .syso 855 System object files. 856 857 Files of each of these types except .syso may contain build 858 constraints, but the go command stops scanning for build constraints 859 at the first item in the file that is not a blank line or //-style 860 line comment. 861 862 863 GOPATH environment variable 864 865 The Go path is used to resolve import statements. 866 It is implemented by and documented in the go/build package. 867 868 The GOPATH environment variable lists places to look for Go code. 869 On Unix, the value is a colon-separated string. 870 On Windows, the value is a semicolon-separated string. 871 On Plan 9, the value is a list. 872 873 GOPATH must be set to get, build and install packages outside the 874 standard Go tree. 875 876 Each directory listed in GOPATH must have a prescribed structure: 877 878 The src directory holds source code. The path below src 879 determines the import path or executable name. 880 881 The pkg directory holds installed package objects. 882 As in the Go tree, each target operating system and 883 architecture pair has its own subdirectory of pkg 884 (pkg/GOOS_GOARCH). 885 886 If DIR is a directory listed in the GOPATH, a package with 887 source in DIR/src/foo/bar can be imported as "foo/bar" and 888 has its compiled form installed to "DIR/pkg/GOOS_GOARCH/foo/bar.a". 889 890 The bin directory holds compiled commands. 891 Each command is named for its source directory, but only 892 the final element, not the entire path. That is, the 893 command with source in DIR/src/foo/quux is installed into 894 DIR/bin/quux, not DIR/bin/foo/quux. The "foo/" prefix is stripped 895 so that you can add DIR/bin to your PATH to get at the 896 installed commands. If the GOBIN environment variable is 897 set, commands are installed to the directory it names instead 898 of DIR/bin. GOBIN must be an absolute path. 899 900 Here's an example directory layout: 901 902 GOPATH=/home/user/gocode 903 904 /home/user/gocode/ 905 src/ 906 foo/ 907 bar/ (go code in package bar) 908 x.go 909 quux/ (go code in package main) 910 y.go 911 bin/ 912 quux (installed command) 913 pkg/ 914 linux_amd64/ 915 foo/ 916 bar.a (installed package object) 917 918 Go searches each directory listed in GOPATH to find source code, 919 but new packages are always downloaded into the first directory 920 in the list. 921 922 See https://golang.org/doc/code.html for an example. 923 924 Internal Directories 925 926 Code in or below a directory named "internal" is importable only 927 by code in the directory tree rooted at the parent of "internal". 928 Here's an extended version of the directory layout above: 929 930 /home/user/gocode/ 931 src/ 932 crash/ 933 bang/ (go code in package bang) 934 b.go 935 foo/ (go code in package foo) 936 f.go 937 bar/ (go code in package bar) 938 x.go 939 internal/ 940 baz/ (go code in package baz) 941 z.go 942 quux/ (go code in package main) 943 y.go 944 945 946 The code in z.go is imported as "foo/internal/baz", but that 947 import statement can only appear in source files in the subtree 948 rooted at foo. The source files foo/f.go, foo/bar/x.go, and 949 foo/quux/y.go can all import "foo/internal/baz", but the source file 950 crash/bang/b.go cannot. 951 952 See https://golang.org/s/go14internal for details. 953 954 Vendor Directories 955 956 Go 1.6 includes support for using local copies of external dependencies 957 to satisfy imports of those dependencies, often referred to as vendoring. 958 959 Code below a directory named "vendor" is importable only 960 by code in the directory tree rooted at the parent of "vendor", 961 and only using an import path that omits the prefix up to and 962 including the vendor element. 963 964 Here's the example from the previous section, 965 but with the "internal" directory renamed to "vendor" 966 and a new foo/vendor/crash/bang directory added: 967 968 /home/user/gocode/ 969 src/ 970 crash/ 971 bang/ (go code in package bang) 972 b.go 973 foo/ (go code in package foo) 974 f.go 975 bar/ (go code in package bar) 976 x.go 977 vendor/ 978 crash/ 979 bang/ (go code in package bang) 980 b.go 981 baz/ (go code in package baz) 982 z.go 983 quux/ (go code in package main) 984 y.go 985 986 The same visibility rules apply as for internal, but the code 987 in z.go is imported as "baz", not as "foo/vendor/baz". 988 989 Code in vendor directories deeper in the source tree shadows 990 code in higher directories. Within the subtree rooted at foo, an import 991 of "crash/bang" resolves to "foo/vendor/crash/bang", not the 992 top-level "crash/bang". 993 994 Code in vendor directories is not subject to import path 995 checking (see 'go help importpath'). 996 997 When 'go get' checks out or updates a git repository, it now also 998 updates submodules. 999 1000 Vendor directories do not affect the placement of new repositories 1001 being checked out for the first time by 'go get': those are always 1002 placed in the main GOPATH, never in a vendor subtree. 1003 1004 In Go 1.5, as an experiment, setting the environment variable 1005 GO15VENDOREXPERIMENT=1 enabled these features. 1006 As of Go 1.6 they are on by default. To turn them off, set 1007 GO15VENDOREXPERIMENT=0. In Go 1.7, the environment 1008 variable will stop having any effect. 1009 1010 The vendoring semantics are an experiment, and they may change 1011 in future releases. Once settled, they will be on by default. 1012 1013 See https://golang.org/s/go15vendor for details. 1014 1015 1016 Environment variables 1017 1018 The go command, and the tools it invokes, examine a few different 1019 environment variables. For many of these, you can see the default 1020 value of on your system by running 'go env NAME', where NAME is the 1021 name of the variable. 1022 1023 General-purpose environment variables: 1024 1025 GCCGO 1026 The gccgo command to run for 'go build -compiler=gccgo'. 1027 GOARCH 1028 The architecture, or processor, for which to compile code. 1029 Examples are amd64, 386, arm, ppc64. 1030 GOBIN 1031 The directory where 'go install' will install a command. 1032 GOOS 1033 The operating system for which to compile code. 1034 Examples are linux, darwin, windows, netbsd. 1035 GOPATH 1036 See 'go help gopath'. 1037 GORACE 1038 Options for the race detector. 1039 See https://golang.org/doc/articles/race_detector.html. 1040 GOROOT 1041 The root of the go tree. 1042 1043 Environment variables for use with cgo: 1044 1045 CC 1046 The command to use to compile C code. 1047 CGO_ENABLED 1048 Whether the cgo command is supported. Either 0 or 1. 1049 CGO_CFLAGS 1050 Flags that cgo will pass to the compiler when compiling 1051 C code. 1052 CGO_CPPFLAGS 1053 Flags that cgo will pass to the compiler when compiling 1054 C or C++ code. 1055 CGO_CXXFLAGS 1056 Flags that cgo will pass to the compiler when compiling 1057 C++ code. 1058 CGO_LDFLAGS 1059 Flags that cgo will pass to the compiler when linking. 1060 CXX 1061 The command to use to compile C++ code. 1062 1063 Architecture-specific environment variables: 1064 1065 GOARM 1066 For GOARCH=arm, the ARM architecture for which to compile. 1067 Valid values are 5, 6, 7. 1068 GO386 1069 For GOARCH=386, the floating point instruction set. 1070 Valid values are 387, sse2. 1071 1072 Special-purpose environment variables: 1073 1074 GOROOT_FINAL 1075 The root of the installed Go tree, when it is 1076 installed in a location other than where it is built. 1077 File names in stack traces are rewritten from GOROOT to 1078 GOROOT_FINAL. 1079 GO15VENDOREXPERIMENT 1080 Set to 1 to enable the Go 1.5 vendoring experiment. 1081 GO_EXTLINK_ENABLED 1082 Whether the linker should use external linking mode 1083 when using -linkmode=auto with code that uses cgo. 1084 Set to 0 to disable external linking mode, 1 to enable it. 1085 1086 1087 Import path syntax 1088 1089 An import path (see 'go help packages') denotes a package 1090 stored in the local file system. In general, an import path denotes 1091 either a standard package (such as "unicode/utf8") or a package 1092 found in one of the work spaces (see 'go help gopath'). 1093 1094 Relative import paths 1095 1096 An import path beginning with ./ or ../ is called a relative path. 1097 The toolchain supports relative import paths as a shortcut in two ways. 1098 1099 First, a relative path can be used as a shorthand on the command line. 1100 If you are working in the directory containing the code imported as 1101 "unicode" and want to run the tests for "unicode/utf8", you can type 1102 "go test ./utf8" instead of needing to specify the full path. 1103 Similarly, in the reverse situation, "go test .." will test "unicode" from 1104 the "unicode/utf8" directory. Relative patterns are also allowed, like 1105 "go test ./..." to test all subdirectories. See 'go help packages' for details 1106 on the pattern syntax. 1107 1108 Second, if you are compiling a Go program not in a work space, 1109 you can use a relative path in an import statement in that program 1110 to refer to nearby code also not in a work space. 1111 This makes it easy to experiment with small multipackage programs 1112 outside of the usual work spaces, but such programs cannot be 1113 installed with "go install" (there is no work space in which to install them), 1114 so they are rebuilt from scratch each time they are built. 1115 To avoid ambiguity, Go programs cannot use relative import paths 1116 within a work space. 1117 1118 Remote import paths 1119 1120 Certain import paths also 1121 describe how to obtain the source code for the package using 1122 a revision control system. 1123 1124 A few common code hosting sites have special syntax: 1125 1126 Bitbucket (Git, Mercurial) 1127 1128 import "bitbucket.org/user/project" 1129 import "bitbucket.org/user/project/sub/directory" 1130 1131 GitHub (Git) 1132 1133 import "github.com/user/project" 1134 import "github.com/user/project/sub/directory" 1135 1136 Google Code Project Hosting (Git, Mercurial, Subversion) 1137 1138 import "code.google.com/p/project" 1139 import "code.google.com/p/project/sub/directory" 1140 1141 import "code.google.com/p/project.subrepository" 1142 import "code.google.com/p/project.subrepository/sub/directory" 1143 1144 Launchpad (Bazaar) 1145 1146 import "launchpad.net/project" 1147 import "launchpad.net/project/series" 1148 import "launchpad.net/project/series/sub/directory" 1149 1150 import "launchpad.net/~user/project/branch" 1151 import "launchpad.net/~user/project/branch/sub/directory" 1152 1153 IBM DevOps Services (Git) 1154 1155 import "hub.jazz.net/git/user/project" 1156 import "hub.jazz.net/git/user/project/sub/directory" 1157 1158 For code hosted on other servers, import paths may either be qualified 1159 with the version control type, or the go tool can dynamically fetch 1160 the import path over https/http and discover where the code resides 1161 from a <meta> tag in the HTML. 1162 1163 To declare the code location, an import path of the form 1164 1165 repository.vcs/path 1166 1167 specifies the given repository, with or without the .vcs suffix, 1168 using the named version control system, and then the path inside 1169 that repository. The supported version control systems are: 1170 1171 Bazaar .bzr 1172 Git .git 1173 Mercurial .hg 1174 Subversion .svn 1175 1176 For example, 1177 1178 import "example.org/user/foo.hg" 1179 1180 denotes the root directory of the Mercurial repository at 1181 example.org/user/foo or foo.hg, and 1182 1183 import "example.org/repo.git/foo/bar" 1184 1185 denotes the foo/bar directory of the Git repository at 1186 example.org/repo or repo.git. 1187 1188 When a version control system supports multiple protocols, 1189 each is tried in turn when downloading. For example, a Git 1190 download tries https://, then git+ssh://. 1191 1192 If the import path is not a known code hosting site and also lacks a 1193 version control qualifier, the go tool attempts to fetch the import 1194 over https/http and looks for a <meta> tag in the document's HTML 1195 <head>. 1196 1197 The meta tag has the form: 1198 1199 <meta name="go-import" content="import-prefix vcs repo-root"> 1200 1201 The import-prefix is the import path corresponding to the repository 1202 root. It must be a prefix or an exact match of the package being 1203 fetched with "go get". If it's not an exact match, another http 1204 request is made at the prefix to verify the <meta> tags match. 1205 1206 The meta tag should appear as early in the file as possible. 1207 In particular, it should appear before any raw JavaScript or CSS, 1208 to avoid confusing the go command's restricted parser. 1209 1210 The vcs is one of "git", "hg", "svn", etc, 1211 1212 The repo-root is the root of the version control system 1213 containing a scheme and not containing a .vcs qualifier. 1214 1215 For example, 1216 1217 import "example.org/pkg/foo" 1218 1219 will result in the following requests: 1220 1221 https://example.org/pkg/foo?go-get=1 (preferred) 1222 http://example.org/pkg/foo?go-get=1 (fallback, only with -insecure) 1223 1224 If that page contains the meta tag 1225 1226 <meta name="go-import" content="example.org git https://code.org/r/p/exproj"> 1227 1228 the go tool will verify that https://example.org/?go-get=1 contains the 1229 same meta tag and then git clone https://code.org/r/p/exproj into 1230 GOPATH/src/example.org. 1231 1232 New downloaded packages are written to the first directory 1233 listed in the GOPATH environment variable (see 'go help gopath'). 1234 1235 The go command attempts to download the version of the 1236 package appropriate for the Go release being used. 1237 Run 'go help get' for more. 1238 1239 Import path checking 1240 1241 When the custom import path feature described above redirects to a 1242 known code hosting site, each of the resulting packages has two possible 1243 import paths, using the custom domain or the known hosting site. 1244 1245 A package statement is said to have an "import comment" if it is immediately 1246 followed (before the next newline) by a comment of one of these two forms: 1247 1248 package math // import "path" 1249 package math /* import "path" * / 1250 1251 The go command will refuse to install a package with an import comment 1252 unless it is being referred to by that import path. In this way, import comments 1253 let package authors make sure the custom import path is used and not a 1254 direct path to the underlying code hosting site. 1255 1256 If the vendoring experiment is enabled (see 'go help gopath'), 1257 then import path checking is disabled for code found within vendor trees. 1258 This makes it possible to copy code into alternate locations in vendor trees 1259 without needing to update import comments. 1260 1261 See https://golang.org/s/go14customimport for details. 1262 1263 1264 Description of package lists 1265 1266 Many commands apply to a set of packages: 1267 1268 go action [packages] 1269 1270 Usually, [packages] is a list of import paths. 1271 1272 An import path that is a rooted path or that begins with 1273 a . or .. element is interpreted as a file system path and 1274 denotes the package in that directory. 1275 1276 Otherwise, the import path P denotes the package found in 1277 the directory DIR/src/P for some DIR listed in the GOPATH 1278 environment variable (see 'go help gopath'). 1279 1280 If no import paths are given, the action applies to the 1281 package in the current directory. 1282 1283 There are four reserved names for paths that should not be used 1284 for packages to be built with the go tool: 1285 1286 - "main" denotes the top-level package in a stand-alone executable. 1287 1288 - "all" expands to all package directories found in all the GOPATH 1289 trees. For example, 'go list all' lists all the packages on the local 1290 system. 1291 1292 - "std" is like all but expands to just the packages in the standard 1293 Go library. 1294 1295 - "cmd" expands to the Go repository's commands and their 1296 internal libraries. 1297 1298 An import path is a pattern if it includes one or more "..." wildcards, 1299 each of which can match any string, including the empty string and 1300 strings containing slashes. Such a pattern expands to all package 1301 directories found in the GOPATH trees with names matching the 1302 patterns. As a special case, x/... matches x as well as x's subdirectories. 1303 For example, net/... expands to net and packages in its subdirectories. 1304 1305 An import path can also name a package to be downloaded from 1306 a remote repository. Run 'go help importpath' for details. 1307 1308 Every package in a program must have a unique import path. 1309 By convention, this is arranged by starting each path with a 1310 unique prefix that belongs to you. For example, paths used 1311 internally at Google all begin with 'google', and paths 1312 denoting remote repositories begin with the path to the code, 1313 such as 'github.com/user/repo'. 1314 1315 As a special case, if the package list is a list of .go files from a 1316 single directory, the command is applied to a single synthesized 1317 package made up of exactly those files, ignoring any build constraints 1318 in those files and ignoring any other files in the directory. 1319 1320 Directory and file names that begin with "." or "_" are ignored 1321 by the go tool, as are directories named "testdata". 1322 1323 1324 Description of testing flags 1325 1326 The 'go test' command takes both flags that apply to 'go test' itself 1327 and flags that apply to the resulting test binary. 1328 1329 Several of the flags control profiling and write an execution profile 1330 suitable for "go tool pprof"; run "go tool pprof -h" for more 1331 information. The --alloc_space, --alloc_objects, and --show_bytes 1332 options of pprof control how the information is presented. 1333 1334 The following flags are recognized by the 'go test' command and 1335 control the execution of any test: 1336 1337 -bench regexp 1338 Run benchmarks matching the regular expression. 1339 By default, no benchmarks run. To run all benchmarks, 1340 use '-bench .' or '-bench=.'. 1341 1342 -benchmem 1343 Print memory allocation statistics for benchmarks. 1344 1345 -benchtime t 1346 Run enough iterations of each benchmark to take t, specified 1347 as a time.Duration (for example, -benchtime 1h30s). 1348 The default is 1 second (1s). 1349 1350 -blockprofile block.out 1351 Write a goroutine blocking profile to the specified file 1352 when all tests are complete. 1353 Writes test binary as -c would. 1354 1355 -blockprofilerate n 1356 Control the detail provided in goroutine blocking profiles by 1357 calling runtime.SetBlockProfileRate with n. 1358 See 'go doc runtime.SetBlockProfileRate'. 1359 The profiler aims to sample, on average, one blocking event every 1360 n nanoseconds the program spends blocked. By default, 1361 if -test.blockprofile is set without this flag, all blocking events 1362 are recorded, equivalent to -test.blockprofilerate=1. 1363 1364 -count n 1365 Run each test and benchmark n times (default 1). 1366 If -cpu is set, run n times for each GOMAXPROCS value. 1367 Examples are always run once. 1368 1369 -cover 1370 Enable coverage analysis. 1371 1372 -covermode set,count,atomic 1373 Set the mode for coverage analysis for the package[s] 1374 being tested. The default is "set" unless -race is enabled, 1375 in which case it is "atomic". 1376 The values: 1377 set: bool: does this statement run? 1378 count: int: how many times does this statement run? 1379 atomic: int: count, but correct in multithreaded tests; 1380 significantly more expensive. 1381 Sets -cover. 1382 1383 -coverpkg pkg1,pkg2,pkg3 1384 Apply coverage analysis in each test to the given list of packages. 1385 The default is for each test to analyze only the package being tested. 1386 Packages are specified as import paths. 1387 Sets -cover. 1388 1389 -coverprofile cover.out 1390 Write a coverage profile to the file after all tests have passed. 1391 Sets -cover. 1392 1393 -cpu 1,2,4 1394 Specify a list of GOMAXPROCS values for which the tests or 1395 benchmarks should be executed. The default is the current value 1396 of GOMAXPROCS. 1397 1398 -cpuprofile cpu.out 1399 Write a CPU profile to the specified file before exiting. 1400 Writes test binary as -c would. 1401 1402 -memprofile mem.out 1403 Write a memory profile to the file after all tests have passed. 1404 Writes test binary as -c would. 1405 1406 -memprofilerate n 1407 Enable more precise (and expensive) memory profiles by setting 1408 runtime.MemProfileRate. See 'go doc runtime.MemProfileRate'. 1409 To profile all memory allocations, use -test.memprofilerate=1 1410 and pass --alloc_space flag to the pprof tool. 1411 1412 -outputdir directory 1413 Place output files from profiling in the specified directory, 1414 by default the directory in which "go test" is running. 1415 1416 -parallel n 1417 Allow parallel execution of test functions that call t.Parallel. 1418 The value of this flag is the maximum number of tests to run 1419 simultaneously; by default, it is set to the value of GOMAXPROCS. 1420 1421 -run regexp 1422 Run only those tests and examples matching the regular 1423 expression. 1424 1425 -short 1426 Tell long-running tests to shorten their run time. 1427 It is off by default but set during all.bash so that installing 1428 the Go tree can run a sanity check but not spend time running 1429 exhaustive tests. 1430 1431 -timeout t 1432 If a test runs longer than t, panic. 1433 The default is 10 minutes (10m). 1434 1435 -trace trace.out 1436 Write an execution trace to the specified file before exiting. 1437 Writes test binary as -c would. 1438 1439 -v 1440 Verbose output: log all tests as they are run. Also print all 1441 text from Log and Logf calls even if the test succeeds. 1442 1443 The test binary, called pkg.test where pkg is the name of the 1444 directory containing the package sources, can be invoked directly 1445 after building it with 'go test -c'. When invoking the test binary 1446 directly, each of the standard flag names must be prefixed with 'test.', 1447 as in -test.run=TestMyFunc or -test.v. 1448 1449 When running 'go test', flags not listed above are passed through 1450 unaltered. For instance, the command 1451 1452 go test -x -v -cpuprofile=prof.out -dir=testdata -update 1453 1454 will compile the test binary and then run it as 1455 1456 pkg.test -test.v -test.cpuprofile=prof.out -dir=testdata -update 1457 1458 The test flags that generate profiles (other than for coverage) also 1459 leave the test binary in pkg.test for use when analyzing the profiles. 1460 1461 Flags not recognized by 'go test' must be placed after any specified packages. 1462 1463 1464 Description of testing functions 1465 1466 The 'go test' command expects to find test, benchmark, and example functions 1467 in the "*_test.go" files corresponding to the package under test. 1468 1469 A test function is one named TestXXX (where XXX is any alphanumeric string 1470 not starting with a lower case letter) and should have the signature, 1471 1472 func TestXXX(t *testing.T) { ... } 1473 1474 A benchmark function is one named BenchmarkXXX and should have the signature, 1475 1476 func BenchmarkXXX(b *testing.B) { ... } 1477 1478 An example function is similar to a test function but, instead of using 1479 *testing.T to report success or failure, prints output to os.Stdout. 1480 That output is compared against the function's "Output:" comment, which 1481 must be the last comment in the function body (see example below). An 1482 example with no such comment, or with no text after "Output:" is compiled 1483 but not executed. 1484 1485 Godoc displays the body of ExampleXXX to demonstrate the use 1486 of the function, constant, or variable XXX. An example of a method M with 1487 receiver type T or *T is named ExampleT_M. There may be multiple examples 1488 for a given function, constant, or variable, distinguished by a trailing _xxx, 1489 where xxx is a suffix not beginning with an upper case letter. 1490 1491 Here is an example of an example: 1492 1493 func ExamplePrintln() { 1494 Println("The output of\nthis example.") 1495 // Output: The output of 1496 // this example. 1497 } 1498 1499 The entire test file is presented as the example when it contains a single 1500 example function, at least one other function, type, variable, or constant 1501 declaration, and no test or benchmark functions. 1502 1503 See the documentation of the testing package for more information. 1504 1505 1506 */ 1507 package main