From 4b9490ee72c225d4d82cb4896f95c757ee8fef89 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 20 Oct 2016 15:08:40 -0400 Subject: [PATCH] fmt: document that unexported struct fields don't get the String/Error treatment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #17409. Change-Id: Ib49ff4a467431b5c1e6637e5144979cf0bfba489 Reviewed-on: https://go-review.googlesource.com/31817 Reviewed-by: Martin Möhrmann Reviewed-by: Quentin Smith --- src/fmt/doc.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/fmt/doc.go b/src/fmt/doc.go index f8ae4e72f9..a2faecb36e 100644 --- a/src/fmt/doc.go +++ b/src/fmt/doc.go @@ -174,6 +174,9 @@ that type has a String method. Such pathologies are rare, however, and the package does not protect against them. + When printing a struct, fmt cannot and therefore does not invoke + formatting methods such as Error or String on unexported fields. + Explicit argument indexes: In Printf, Sprintf, and Fprintf, the default behavior is for each