diff options
author | Rob Pike <r@golang.org> | 2014-09-22 15:35:25 -0700 |
---|---|---|
committer | Rob Pike <r@golang.org> | 2014-09-22 15:35:25 -0700 |
commit | d6d3562761755f7b74776abe4b39e14464099484 (patch) | |
tree | fb5257e983889a3cf0518ba66a8c1ed06057b621 /src/fmt | |
parent | 6fe89548b74e757bff8b67930d1fbc57f2813b77 (diff) | |
download | go-d6d3562761755f7b74776abe4b39e14464099484.tar.gz |
fmt: document that self-recursive data structures can be fatal
Fixes issue 8241.
LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://codereview.appspot.com/144420043
Diffstat (limited to 'src/fmt')
-rw-r--r-- | src/fmt/doc.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/fmt/doc.go b/src/fmt/doc.go index 5af8d3e71..b7eaedc11 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: |