Commit 86e65bac authored by Rob Pike's avatar Rob Pike

reflect: add comment about the doubled semantics of Value.String.

R=rsc
CC=golang-dev
https://golang.org/cl/5091044
parent 76e70531
...@@ -1444,6 +1444,8 @@ func (v Value) String() string { ...@@ -1444,6 +1444,8 @@ func (v Value) String() string {
case String: case String:
return *(*string)(iv.addr) 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>" return "<" + iv.typ.String() + " Value>"
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment