@@ -56,11 +56,16 @@ Here's an example directory layout:
56
56
bar.a (installed package object)
57
57
58
58
### Build Constraints
59
- A build constraint is a line comment beginning with the directive +build
59
+ A build constraint, also known as a build tag, is a line comment that begins
60
+
61
+
62
+ // +build
63
+
60
64
that lists the conditions under which a file should be included in the package.
61
65
Constraints may appear in any kind of source file (not just Go), but
62
66
they must appear near the top of the file, preceded
63
- only by blank lines and other line comments.
67
+ only by blank lines and other line comments. These rules mean that in Go
68
+ files a build constraint must appear before the package clause.
64
69
65
70
To distinguish build constraints from package documentation, a series of
66
71
build constraints must be followed by a blank line.
@@ -236,7 +241,10 @@ A Context specifies the supporting context for a build.
236
241
237
242
238
243
239
- <pre >var Default Context = defaultContext()</pre >
244
+ ``` go
245
+ var Default Context = defaultContext ()
246
+ ```
247
+
240
248
Default is the default Context for builds.
241
249
It uses the GOARCH, GOOS, GOROOT, and GOPATH environment variables
242
250
if set, or else the compiled code's GOARCH, GOOS, and GOROOT.
@@ -309,7 +317,8 @@ An ImportMode controls the behavior of the Import method.
309
317
310
318
311
319
312
- <pre >const (
320
+ ``` go
321
+ const (
313
322
// If FindOnly is set, Import stops after locating the directory
314
323
// that should contain the sources for a package. It does not
315
324
// read any files in the directory.
@@ -318,7 +327,9 @@ An ImportMode controls the behavior of the Import method.
318
327
// If AllowBinary is set, Import can be satisfied by a compiled
319
328
// package object without corresponding sources.
320
329
AllowBinary
321
- )</pre >
330
+ )
331
+ ```
332
+
322
333
323
334
324
335
0 commit comments