From 806dea82d4668c079856b77b3824143500405d25 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 29 Apr 2013 12:01:32 -0700 Subject: [PATCH] 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 --- src/pkg/fmt/doc.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/pkg/fmt/doc.go b/src/pkg/fmt/doc.go index 3cd02d7ede4..b8dd995c77b 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