Skip to content

Commit 4b9490e

Browse files
committed
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 <[email protected]> Reviewed-by: Quentin Smith <[email protected]>
1 parent 59b0e14 commit 4b9490e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/fmt/doc.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@
174174
that type has a String method. Such pathologies are rare, however,
175175
and the package does not protect against them.
176176
177+
When printing a struct, fmt cannot and therefore does not invoke
178+
formatting methods such as Error or String on unexported fields.
179+
177180
Explicit argument indexes:
178181
179182
In Printf, Sprintf, and Fprintf, the default behavior is for each

0 commit comments

Comments
 (0)