mirror of
https://github.com/golang/go
synced 2024-11-19 21:34:45 -07:00
fmt: document that self-recursive data structures can be fatal
Fixes #8241. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/144420043
This commit is contained in:
parent
1392276bfb
commit
892b5074f5
@ -147,6 +147,10 @@
|
|||||||
func (x X) String() string { return Sprintf("<%s>", x) }
|
func (x X) String() string { return Sprintf("<%s>", x) }
|
||||||
convert the value before recurring:
|
convert the value before recurring:
|
||||||
func (x X) String() string { return Sprintf("<%s>", string(x)) }
|
func (x X) String() string { return Sprintf("<%s>", string(x)) }
|
||||||
|
Infinite recursion can also be triggered by self-referential data
|
||||||
|
structures, such as a slice that contains itself as an element, if
|
||||||
|
that type has a String method. Such pathologies are rare, however,
|
||||||
|
and the package does not protect against them.
|
||||||
|
|
||||||
Explicit argument indexes:
|
Explicit argument indexes:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user