]> Cypherpunks repositories - gostls13.git/commitdiff
reflect: add comment about the doubled semantics of Value.String.
authorRob Pike <r@golang.org>
Tue, 20 Sep 2011 20:26:57 +0000 (13:26 -0700)
committerRob Pike <r@golang.org>
Tue, 20 Sep 2011 20:26:57 +0000 (13:26 -0700)
R=rsc
CC=golang-dev
https://golang.org/cl/5091044

src/pkg/reflect/value.go

index 8e5a6282cfa87e9e8b240acdc9cc4bd1726e8aaf..1cace3fdaf6dc0b57edd06b7a64a071c454ce559 100644 (file)
@@ -1444,6 +1444,8 @@ func (v Value) String() string {
        case String:
                return *(*string)(iv.addr)
        }
+       // If you call String on a reflect.Value of other type, it's better to
+       // print something than to panic. Useful in debugging.
        return "<" + iv.typ.String() + " Value>"
 }