]> Cypherpunks repositories - gostls13.git/commitdiff
doc/go_spec: remove extra space, align tags, and change a tab to a space.
authorOling Cat <olingcat@gmail.com>
Thu, 24 Jan 2013 09:46:33 +0000 (20:46 +1100)
committerAndrew Gerrand <adg@golang.org>
Thu, 24 Jan 2013 09:46:33 +0000 (20:46 +1100)
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7198048

doc/go_faq.html
doc/go_spec.html

index ab37696f0fd606d066ccd3f0569dff49014ec0c2..5c68aa7e589fca6ef9cacabf02c02da2a110681c 100644 (file)
@@ -208,7 +208,7 @@ easier to understand what happens when things combine.
 <h3 id="Is_Google_using_go_internally"> Is Google using Go internally?</h3>
 
 <p>
-Yes. There are now several Go programs deployed in 
+Yes. There are now several Go programs deployed in
 production inside Google.  A public example is the server behind
 <a href="http://golang.org">http://golang.org</a>.
 It's just the <a href="/cmd/godoc"><code>godoc</code></a>
@@ -224,14 +224,14 @@ There are two Go compiler implementations, <code>gc</code>
 (the <code>6g</code> program and friends) and <code>gccgo</code>.
 <code>Gc</code> uses a different calling convention and linker and can
 therefore only be linked with C programs using the same convention.
-There is such a C compiler but no C++ compiler. 
-<code>Gccgo</code> is a GCC front-end that can, with care, be linked with 
-GCC-compiled C or C++ programs. 
+There is such a C compiler but no C++ compiler.
+<code>Gccgo</code> is a GCC front-end that can, with care, be linked with
+GCC-compiled C or C++ programs.
 </p>
 
 <p>
-The <a href="/cmd/cgo/">cgo</a> program provides the mechanism for a 
-&ldquo;foreign function interface&rdquo; to allow safe calling of 
+The <a href="/cmd/cgo/">cgo</a> program provides the mechanism for a
+&ldquo;foreign function interface&rdquo; to allow safe calling of
 C libraries from Go code. SWIG extends this capability to C++ libraries.
 </p>
 
@@ -597,7 +597,7 @@ func (b Bar) Foo() {}
 </pre>
 
 <p>
-Most code doesn't make use of such constraints, since they limit the utility of 
+Most code doesn't make use of such constraints, since they limit the utility of
 the interface idea. Sometimes, though, they're necessary to resolve ambiguities
 among similar interfaces.
 </p>
@@ -934,7 +934,7 @@ When the project launched,
 Google Code supported only Subversion and Mercurial.
 Mercurial was a better choice because of its plugin mechanism
 that allowed us to create the "codereview" plugin to connect
-the project to the excellent code review tools at 
+the project to the excellent code review tools at
 <a href="http://codereview.appspot.com">codereview.appspot.com</a>.
 </p>
 
@@ -971,7 +971,7 @@ slice value doesn't copy the data it points to.  Copying an interface value
 makes a copy of the thing stored in the interface value.  If the interface
 value holds a struct, copying the interface value makes a copy of the
 struct.  If the interface value holds a pointer, copying the interface value
-makes a copy of the pointer, but again not the data it points to. 
+makes a copy of the pointer, but again not the data it points to.
 </p>
 
 <h3 id="methods_on_values_or_pointers">
@@ -1148,7 +1148,7 @@ Why doesn't my multi-goroutine program use multiple CPUs?</h3>
 You must set the <code>GOMAXPROCS</code> shell environment variable
 or use the similarly-named <a href="/pkg/runtime/#GOMAXPROCS"><code>function</code></a>
 of the runtime package to allow the
-run-time support to utilize more than one OS thread. 
+run-time support to utilize more than one OS thread.
 </p>
 
 <p>
@@ -1161,7 +1161,7 @@ Why does using <code>GOMAXPROCS</code> &gt; 1 sometimes make my program
 slower?</h3>
 
 <p>
-It depends on the nature of your program. 
+It depends on the nature of your program.
 Problems that are intrinsically sequential cannot be sped up by adding
 more goroutines.
 Concurrency only becomes parallelism when the problem is
@@ -1250,18 +1250,18 @@ func main() {
 
     // wait for all goroutines to complete before exiting
     for _ = range values {
-        &lt;-done 
+        &lt;-done
     }
 }
 </pre>
 
 <p>
-One might mistakenly expect to see <code>a, b, c</code> as the output. 
-What you'll probably see instead is <code>c, c, c</code>.  This is because 
+One might mistakenly expect to see <code>a, b, c</code> as the output.
+What you'll probably see instead is <code>c, c, c</code>.  This is because
 each iteration of the loop uses the same instance of the variable <code>v</code>, so
-each closure shares that single variable. When the closure runs, it prints the 
+each closure shares that single variable. When the closure runs, it prints the
 value of <code>v</code> at the time <code>fmt.Println</code> is executed,
-but <code>v</code> may have been modified since the goroutine was launched. 
+but <code>v</code> may have been modified since the goroutine was launched.
 To help detect this and other problems before they happen, run
 <a href="http://golang.org/cmd/go/#hdr-Run_go_tool_vet_on_packages"><code>go vet</code></a>.
 </p>
@@ -1282,7 +1282,7 @@ One way is to pass the variable as an argument to the closure:
 </pre>
 
 <p>
-In this example, the value of <code>v</code> is passed as an argument to the 
+In this example, the value of <code>v</code> is passed as an argument to the
 anonymous function. That value is then accessible inside the function as
 the variable <code>u</code>.
 </p>
@@ -1478,7 +1478,7 @@ For these reasons, Go allows neither.
 <p>
 When developing code, it's common to create these situations
 temporarily and it can be annoying to have to edit them out before the
-program will compile.  
+program will compile.
 </p>
 
 <p>
@@ -1525,13 +1525,13 @@ Why does Go perform badly on benchmark X?</h3>
 
 <p>
 One of Go's design goals is to approach the performance of C for comparable
-programs, yet on some benchmarks it does quite poorly, including several 
-in <a href="/test/bench/shootout/">test/bench/shootout</a>. The slowest depend on libraries 
-for which versions of comparable performance are not available in Go. 
+programs, yet on some benchmarks it does quite poorly, including several
+in <a href="/test/bench/shootout/">test/bench/shootout</a>. The slowest depend on libraries
+for which versions of comparable performance are not available in Go.
 For instance, <a href="/test/bench/shootout/pidigits.go">pidigits.go</a>
 depends on a multi-precision math package, and the C
 versions, unlike Go's, use <a href="http://gmplib.org/">GMP</a> (which is
-written in optimized assembler). 
+written in optimized assembler).
 Benchmarks that depend on regular expressions
 (<a href="/test/bench/shootout/regex-dna.go">regex-dna.go</a>, for instance) are
 essentially comparing Go's native <a href="/pkg/regexp">regexp package</a> to
@@ -1550,7 +1550,7 @@ indicate.
 <p>
 Still, there is room for improvement. The compilers are good but could be
 better, many libraries need major performance work, and the garbage collector
-isn't fast enough yet. (Even if it were, taking care not to generate unnecessary 
+isn't fast enough yet. (Even if it were, taking care not to generate unnecessary
 garbage can have a huge effect.)
 </p>
 
index c93bb6c65d46d2cb7a52f1a64406630aa7328302..b8502bd5a76f187aa42c384f6efac26633b55162 100644 (file)
@@ -2506,7 +2506,7 @@ If <code>a</code> is not a map:
        <li>the index <code>x</code> must be an integer value; it is <i>in range</i> if <code>0 &lt;= x &lt; len(a)</code>,
            otherwise it is <i>out of range</i></li>
        <li>a <a href="#Constants">constant</a> index must be non-negative
-            and representable by a value of type <code>int</code>
+           and representable by a value of type <code>int</code>
 </ul>
 
 <p>
@@ -2518,7 +2518,7 @@ where <code>A</code> is an <a href="#Array_types">array type</a>:
        <li>if <code>a</code> is <code>nil</code> or if <code>x</code> is out of range at run time,
            a <a href="#Run_time_panics">run-time panic</a> occurs</li>
        <li><code>a[x]</code> is the array element at index <code>x</code> and the type of
-         <code>a[x]</code> is the element type of <code>A</code></li>
+           <code>a[x]</code> is the element type of <code>A</code></li>
 </ul>
 
 <p>
@@ -2528,7 +2528,7 @@ For <code>a</code> of type <code>S</code> where <code>S</code> is a <a href="#Sl
        <li>if the slice is <code>nil</code> or if <code>x</code> is out of range at run time,
            a <a href="#Run_time_panics">run-time panic</a> occurs</li>
        <li><code>a[x]</code> is the slice element at index <code>x</code> and the type of
-         <code>a[x]</code> is the element type of <code>S</code></li>
+           <code>a[x]</code> is the element type of <code>S</code></li>
 </ul>
 
 <p>
@@ -2541,7 +2541,7 @@ where <code>T</code> is a <a href="#String_types">string type</a>:
        <li>if <code>x</code> is out of range at run time,
            a <a href="#Run_time_panics">run-time panic</a> occurs</li>
        <li><code>a[x]</code> is the byte at index <code>x</code> and the type of
-         <code>a[x]</code> is <code>byte</code></li>
+           <code>a[x]</code> is <code>byte</code></li>
        <li><code>a[x]</code> may not be assigned to</li>
 </ul>
 
@@ -2551,14 +2551,14 @@ where <code>M</code> is a <a href="#Map_types">map type</a>:
 </p>
 <ul>
        <li><code>x</code>'s type must be
-       <a href="#Assignability">assignable</a>
-       to the key type of <code>M</code></li>
+           <a href="#Assignability">assignable</a>
+           to the key type of <code>M</code></li>
        <li>if the map contains an entry with key <code>x</code>,
-         <code>a[x]</code> is the map value with key <code>x</code>
-         and the type of <code>a[x]</code> is the value type of <code>M</code></li>
+           <code>a[x]</code> is the map value with key <code>x</code>
+           and the type of <code>a[x]</code> is the value type of <code>M</code></li>
        <li>if the map is <code>nil</code> or does not contain such an entry,
-         <code>a[x]</code> is the <a href="#The_zero_value">zero value</a>
-         for the value type of <code>M</code></li>
+           <code>a[x]</code> is the <a href="#The_zero_value">zero value</a>
+           for the value type of <code>M</code></li>
 </ul>
 
 <p>
@@ -5008,7 +5008,7 @@ a <a href="#Run_time_panics">run-time panic</a> occurs.
 s := make([]int, 10, 100)       // slice with len(s) == 10, cap(s) == 100
 s := make([]int, 1e3)           // slice with len(s) == cap(s) == 1000
 s := make([]int, 1&lt;&lt;63)         // illegal: len(s) is not representable by a value of type int
-s := make([]int, 10, 0)                // illegal: len(s) > cap(s)
+s := make([]int, 10, 0)         // illegal: len(s) > cap(s)
 c := make(chan int, 10)         // channel with a buffer size of 10
 m := make(map[string]int, 100)  // map with initial space for 100 elements
 </pre>