LEFT | RIGHT |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // Package build gathers information about Go packages. | 5 // Package build gathers information about Go packages. |
6 // | 6 // |
7 // Go Path | 7 // Go Path |
8 // | 8 // |
9 // The Go path is a list of directory trees containing Go source code. | 9 // The Go path is a list of directory trees containing Go source code. |
10 // It is consulted to resolve imports that cannot be found in the standard | 10 // It is consulted to resolve imports that cannot be found in the standard |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // During a particular build, the following words are satisfied: | 90 // During a particular build, the following words are satisfied: |
91 // | 91 // |
92 // - the target operating system, as spelled by runtime.GOOS | 92 // - the target operating system, as spelled by runtime.GOOS |
93 // - the target architecture, as spelled by runtime.GOARCH | 93 // - the target architecture, as spelled by runtime.GOARCH |
94 // - the compiler being used, either "gc" or "gccgo" | 94 // - the compiler being used, either "gc" or "gccgo" |
95 // - "cgo", if ctxt.CgoEnabled is true | 95 // - "cgo", if ctxt.CgoEnabled is true |
96 // - "go1.1", from Go version 1.1 onward | 96 // - "go1.1", from Go version 1.1 onward |
97 // - any additional words listed in ctxt.BuildTags | 97 // - any additional words listed in ctxt.BuildTags |
98 // | 98 // |
99 // If a file's name, after stripping the extension and a possible _test suffix, | 99 // If a file's name, after stripping the extension and a possible _test suffix, |
100 // matches GOOS, GOARCH, *_GOOS, *_GOARCH, or *_GOOS_GOARCH for any known operat
ing | 100 // matches any of the following patterns: |
101 // system and architecture values, then the file is considered to have an implic
it | 101 //» *_GOOS |
102 // build constraint requiring those terms. | 102 // » *_GOARCH |
| 103 // » *_GOOS_GOARCH |
| 104 // (example: source_windows_amd64.go) or the literals: |
| 105 //» GOOS |
| 106 // » GOARCH |
| 107 // (example: windows.go) where GOOS and GOARCH represent any known operating |
| 108 // system and architecture values respectively, then the file is considered to |
| 109 // have an implicit build constraint requiring those terms. |
103 // | 110 // |
104 // To keep a file from being considered for the build: | 111 // To keep a file from being considered for the build: |
105 // | 112 // |
106 // // +build ignore | 113 // // +build ignore |
107 // | 114 // |
108 // (any other unsatisfied word will work as well, but ``ignore'' is conventional
.) | 115 // (any other unsatisfied word will work as well, but ``ignore'' is conventional
.) |
109 // | 116 // |
110 // To build a file only when using cgo, and only on Linux and OS X: | 117 // To build a file only when using cgo, and only on Linux and OS X: |
111 // | 118 // |
112 // // +build linux,cgo darwin,cgo | 119 // // +build linux,cgo darwin,cgo |
113 // | 120 // |
114 // Such a file is usually paired with another file implementing the | 121 // Such a file is usually paired with another file implementing the |
115 // default functionality for other systems, which in this case would | 122 // default functionality for other systems, which in this case would |
116 // carry the constraint: | 123 // carry the constraint: |
117 // | 124 // |
118 // // +build !linux,!darwin !cgo | 125 // // +build !linux,!darwin !cgo |
119 // | 126 // |
120 // Naming a file dns_windows.go will cause it to be included only when | 127 // Naming a file dns_windows.go will cause it to be included only when |
121 // building the package for Windows; similarly, math_386.s will be included | 128 // building the package for Windows; similarly, math_386.s will be included |
122 // only when building the package for 32-bit x86. | 129 // only when building the package for 32-bit x86. |
123 // | 130 // |
124 package build | 131 package build |
LEFT | RIGHT |