aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2011-01-05 11:39:57 -0800
committerRob Pike <r@golang.org>2011-01-05 11:39:57 -0800
commit29d0f02bd24541adbcee5c5b5583371c2b72d7d5 (patch)
tree68293e0d39f9927fec9e3151b289fcc71bd33d2f
parent0f26608ebcfbe08aaf1ba2f3b0592cc5ce1feec1 (diff)
downloadgo-29d0f02bd24541adbcee5c5b5583371c2b72d7d5.tar.gz
go-29d0f02bd24541adbcee5c5b5583371c2b72d7d5.zip
effective go: explain the effect of repanicking better.
Also fix a <p> error in go_spec.html. Fixes #1370. R=rsc, gri CC=golang-dev https://golang.org/cl/3835043
-rw-r--r--doc/effective_go.html13
-rw-r--r--doc/go_spec.html4
2 files changed, 14 insertions, 3 deletions
diff --git a/doc/effective_go.html b/doc/effective_go.html
index b70d60a925..26e317b5d2 100644
--- a/doc/effective_go.html
+++ b/doc/effective_go.html
@@ -2792,7 +2792,7 @@ user-triggered errors.
</p>
<p>
-With this error handling in place, the <code>error</code> method
+With error handling in place, the <code>error</code> method
makes it easy to report parse errors without worrying about unwinding
the parse stack by hand.
</p>
@@ -2804,6 +2804,17 @@ Useful though this pattern is, it should be used only within a package.
to its client. That is a good rule to follow.
</p>
+<p>
+By the way, this re-panic idiom changes the panic value if an actual
+error occurs. However, both the original and new failures will be
+presented in the crash report, so the root cause of the problem will
+still be visible. Thus this simple re-panic approach is usually
+sufficient&mdash;it's a crash after all&mdash;but if you want to
+display only the original value, you can write a little more code to
+filter unexpected problems and re-panic with the original error.
+That's left as an exercise for the reader.
+</p>
+
<h2 id="web_server">A web server</h2>
diff --git a/doc/go_spec.html b/doc/go_spec.html
index 1b1deaba2c..d12d51344d 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -3973,9 +3973,9 @@ As with an assignment, the operands on the left must be
<a href="#Address_operators">addressable</a> or map index expressions; they
denote the iteration variables. If the range expression is a channel, only
one iteration variable is permitted, otherwise there may be one or two.
-<p>
-
</p>
+
+<p>
The range expression is evaluated once before beginning the loop.
Function calls on the left are evaluated once per iteration.
For each iteration, iteration values are produced as follows: