aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2013-04-29 12:01:32 -0700
committerIan Lance Taylor <iant@golang.org>2013-04-29 12:01:32 -0700
commit806dea82d4668c079856b77b3824143500405d25 (patch)
tree1767cb7e5faedba63842f6afd1596155ad63b232
parent13721cf68860ef98358720ed10aef0e8be39e300 (diff)
downloadgo-806dea82d4668c079856b77b3824143500405d25.tar.gz
go-806dea82d4668c079856b77b3824143500405d25.zip
fmt: document that if String or Error panics, that value is printed
Fixes #5350. R=r, minux.ma CC=golang-dev https://golang.org/cl/8950043
-rw-r--r--src/pkg/fmt/doc.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/pkg/fmt/doc.go b/src/pkg/fmt/doc.go
index 3cd02d7ede..b8dd995c77 100644
--- a/src/pkg/fmt/doc.go
+++ b/src/pkg/fmt/doc.go
@@ -138,6 +138,16 @@
by a single character (the verb) and end with a parenthesized
description.
+ If an Error or String method triggers a panic when called by a
+ print routine, the fmt package reformats the error message
+ from the panic, decorating it with an indication that it came
+ through the fmt package. For example, if a String method
+ calls panic("bad"), the resulting formatted message will look
+ like
+ %s(PANIC=bad)
+
+ The %s just shows the print verb in use when the failure
+ occurred.
Scanning