summaryrefslogtreecommitdiff
path: root/src/pkg/go/build/doc.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/go/build/doc.go')
-rw-r--r--src/pkg/go/build/doc.go28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/pkg/go/build/doc.go b/src/pkg/go/build/doc.go
index 67c26ac7f..c562d05d0 100644
--- a/src/pkg/go/build/doc.go
+++ b/src/pkg/go/build/doc.go
@@ -23,12 +23,12 @@
// As in the Go tree, each target operating system and
// architecture pair has its own subdirectory of pkg
// (pkg/GOOS_GOARCH).
-//
+//
// If DIR is a directory listed in the Go path, a package with
// source in DIR/src/foo/bar can be imported as "foo/bar" and
// has its compiled form installed to "DIR/pkg/GOOS_GOARCH/foo/bar.a"
// (or, for gccgo, "DIR/pkg/gccgo/foo/libbar.a").
-//
+//
// The bin/ directory holds compiled commands.
// Each command is named for its source directory, but only
// using the final element, not the entire path. That is, the
@@ -36,11 +36,11 @@
// DIR/bin/quux, not DIR/bin/foo/quux. The foo/ is stripped
// so that you can add DIR/bin to your PATH to get at the
// installed commands.
-//
+//
// Here's an example directory layout:
-//
+//
// GOPATH=/home/user/gocode
-//
+//
// /home/user/gocode/
// src/
// foo/
@@ -60,9 +60,12 @@
// A build constraint is a line comment beginning with the directive +build
// that lists the conditions under which a file should be included in the package.
// Constraints may appear in any kind of source file (not just Go), but
-// they must be appear near the top of the file, preceded
+// they must appear near the top of the file, preceded
// only by blank lines and other line comments.
//
+// To distinguish build constraints from package documentation, a series of
+// build constraints must be followed by a blank line.
+//
// A build constraint is evaluated as the OR of space-separated options;
// each option evaluates as the AND of its comma-separated terms;
// and each term is an alphanumeric word or, preceded by !, its negation.
@@ -74,10 +77,21 @@
//
// (linux AND 386) OR (darwin AND (NOT cgo))
//
+// A file may have multiple build constraints. The overall constraint is the AND
+// of the individual constraints. That is, the build constraints:
+//
+// // +build linux darwin
+// // +build 386
+//
+// corresponds to the boolean formula:
+//
+// (linux OR darwin) AND 386
+//
// During a particular build, the following words are satisfied:
//
// - the target operating system, as spelled by runtime.GOOS
// - the target architecture, as spelled by runtime.GOARCH
+// - the compiler being used, currently either "gc" or "gccgo"
// - "cgo", if ctxt.CgoEnabled is true
// - any additional words listed in ctxt.BuildTags
//
@@ -100,7 +114,7 @@
// default functionality for other systems, which in this case would
// carry the constraint:
//
-// // +build !linux !darwin !cgo
+// // +build !linux,!darwin !cgo
//
// Naming a file dns_windows.go will cause it to be included only when
// building the package for Windows; similarly, math_386.s will be included