diff --git a/doc/effective_go.html b/doc/effective_go.html index 1aeed4ad84e..86b2d63dcba 100644 --- a/doc/effective_go.html +++ b/doc/effective_go.html @@ -1489,6 +1489,12 @@ to print in the format 7/-2.35/"abc\tdef"
+(If you need to print values of type T
as well as pointers to T
,
+the receiver for String
must be of value type; this example used a pointer because
+that's more efficient and idiomatic for struct types.
+See the section below on pointers vs. value receivers for more information.)
+
Our String()
method is able to call Sprintf
because the
print routines are fully reentrant and can be used recursively.
We can even go one step further and pass a print routine's arguments directly to another such routine.