mirror of
https://github.com/golang/go
synced 2024-11-22 00:14:42 -07:00
fix some typos in the documentation
Fixes #196. R=rsc https://golang.org/cl/154152
This commit is contained in:
parent
27779dd6cb
commit
029c39f45a
@ -977,14 +977,14 @@ you can pass a pointer to the array.
|
|||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
func Sum(a *[3]float) (sum float) {
|
func Sum(a *[3]float) (sum float) {
|
||||||
for _, v := range a {
|
for _, v := range *a {
|
||||||
sum += v
|
sum += v
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
array := [...]float{7.0, 8.5, 9.1};
|
array := [...]float{7.0, 8.5, 9.1};
|
||||||
x := sum(&array); // Note the explicit address-of operator
|
x := Sum(&array); // Note the explicit address-of operator
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@ -550,7 +550,7 @@ declaration on line 31; it declares <code>r</code> and <code>e</code> to hold th
|
|||||||
both of type <code>int</code> (although you'd have to look at the <code>syscall</code> package
|
both of type <code>int</code> (although you'd have to look at the <code>syscall</code> package
|
||||||
to see that). Finally, line 35 returns two values: a pointer to the new <code>File</code>
|
to see that). Finally, line 35 returns two values: a pointer to the new <code>File</code>
|
||||||
and the error. If <code>syscall.Open</code> fails, the file descriptor <code>r</code> will
|
and the error. If <code>syscall.Open</code> fails, the file descriptor <code>r</code> will
|
||||||
be negative and <code>NewFile</code> will return <code>nil</code>.
|
be negative and <code>newFile</code> will return <code>nil</code>.
|
||||||
<p>
|
<p>
|
||||||
About those errors: The <code>os</code> library includes a general notion of an error.
|
About those errors: The <code>os</code> library includes a general notion of an error.
|
||||||
It's a good idea to use its facility in your own interfaces, as we do here, for
|
It's a good idea to use its facility in your own interfaces, as we do here, for
|
||||||
@ -1279,7 +1279,7 @@ code that invokes the operation and responds to the request:
|
|||||||
19 }
|
19 }
|
||||||
</pre>
|
</pre>
|
||||||
<p>
|
<p>
|
||||||
Line 18 defines the name <code>binOp</code> to be a function taking two integers and
|
Line 14 defines the name <code>binOp</code> to be a function taking two integers and
|
||||||
returning a third.
|
returning a third.
|
||||||
<p>
|
<p>
|
||||||
The <code>server</code> routine loops forever, receiving requests and, to avoid blocking due to
|
The <code>server</code> routine loops forever, receiving requests and, to avoid blocking due to
|
||||||
|
@ -841,7 +841,7 @@ code that invokes the operation and responds to the request:
|
|||||||
|
|
||||||
--PROG progs/server.go /type.binOp/ /^}/
|
--PROG progs/server.go /type.binOp/ /^}/
|
||||||
|
|
||||||
Line 18 defines the name "binOp" to be a function taking two integers and
|
Line 14 defines the name "binOp" to be a function taking two integers and
|
||||||
returning a third.
|
returning a third.
|
||||||
|
|
||||||
The "server" routine loops forever, receiving requests and, to avoid blocking due to
|
The "server" routine loops forever, receiving requests and, to avoid blocking due to
|
||||||
|
Loading…
Reference in New Issue
Block a user