From: Russ Cox Date: Thu, 20 Oct 2016 19:08:40 +0000 (-0400) Subject: fmt: document that unexported struct fields don't get the String/Error treatment X-Git-Tag: go1.8beta1~607 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=4b9490ee72c225d4d82cb4896f95c757ee8fef89;p=gostls13.git fmt: document that unexported struct fields don't get the String/Error treatment Fixes #17409. Change-Id: Ib49ff4a467431b5c1e6637e5144979cf0bfba489 Reviewed-on: https://go-review.googlesource.com/31817 Reviewed-by: Martin Möhrmann Reviewed-by: Quentin Smith --- 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