aboutsummaryrefslogtreecommitdiff
path: root/src/fmt
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2016-10-20 15:08:40 -0400
committerRuss Cox <rsc@golang.org>2016-10-26 13:56:45 +0000
commit4b9490ee72c225d4d82cb4896f95c757ee8fef89 (patch)
tree1e9a73938fc01397dbc72e90d68f71756fe1c4c1 /src/fmt
parent59b0e147603e4a3a6170b56e30383a94e157e37a (diff)
downloadgo-4b9490ee72c225d4d82cb4896f95c757ee8fef89.tar.xz
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 <martisch@uos.de> Reviewed-by: Quentin Smith <quentin@golang.org>
Diffstat (limited to 'src/fmt')
-rw-r--r--src/fmt/doc.go3
1 files changed, 3 insertions, 0 deletions
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