From: Rob Pike Date: Mon, 22 Sep 2014 22:35:25 +0000 (-0700) Subject: fmt: document that self-recursive data structures can be fatal X-Git-Tag: go1.4beta1~325 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=892b5074f521ae812b880808e0bd79ee2a02b1a1;p=gostls13.git 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 --- diff --git a/src/fmt/doc.go b/src/fmt/doc.go index 5af8d3e717..b7eaedc11e 100644 --- a/src/fmt/doc.go +++ b/src/fmt/doc.go @@ -147,6 +147,10 @@ func (x X) String() string { return Sprintf("<%s>", x) } convert the value before recurring: 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: