]> Cypherpunks repositories - gostls13.git/commitdiff
doc: document go1.1 build tag
authorAndrew Gerrand <adg@golang.org>
Mon, 8 Apr 2013 01:41:01 +0000 (11:41 +1000)
committerAndrew Gerrand <adg@golang.org>
Mon, 8 Apr 2013 01:41:01 +0000 (11:41 +1000)
Fixes #5235.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8426048

doc/go1.1.html
src/pkg/go/build/doc.go

index fac922910acdabf5223c5f01406d9d4387bdd6d3..1332be21ce1cb0b387a25f853eb4cee36ad8284d 100644 (file)
@@ -403,6 +403,31 @@ command now returns an error if test files are provided on the command line. In
 this sense, "<code>go run</code>" replaces "<code>go run *.go</code>".
 </p>
 
+<h3 id="tags">Build constraints</h3>
+
+<p>
+The <code>"go1.1</code>" tag has been added to the list of default
+<a href="/pkg/go/build/#hdr-Build_Constraints">build constraints</a>.
+This permits packages to take advanage of the new features in Go 1.1 while
+remaining compatible with earlier versions of Go.
+</p>
+
+<p>
+To build a file only with Go 1.1 and above, add this build constraint:
+</p>
+
+<pre>
+// +build go1.1
+</pre>
+
+<p>
+To build a file only with Go 1.0.x, use the converse constraint:
+</p>
+
+<pre>
+// +build !go1.1
+</pre>
+
 <h3 id="platforms">Additional platforms</h3>
 
 <p>
index c562d05d00fba8417d2c8ce733c60d260cb0ade2..4b66b84bb6d60f68dbec7ffc229bf9cb6c17bc18 100644 (file)
@@ -91,8 +91,9 @@
 //
 //     - 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"
+//     - the compiler being used, either "gc" or "gccgo"
 //     - "cgo", if ctxt.CgoEnabled is true
+//     - "go1.1", from Go version 1.1 onward
 //     - any additional words listed in ctxt.BuildTags
 //
 // If a file's name, after stripping the extension and a possible _test suffix,