From: Russ Cox Date: Thu, 1 Mar 2012 22:55:47 +0000 (-0500) Subject: reflect: expand doc for Value.Interface X-Git-Tag: weekly.2012-03-04~48 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=af95499619f731e8f93a316ba70fa2cd732d0d17;p=gostls13.git reflect: expand doc for Value.Interface R=golang-dev, r CC=golang-dev https://golang.org/cl/5716057 --- diff --git a/src/pkg/reflect/value.go b/src/pkg/reflect/value.go index 39f8acdea4..f3f7d639a0 100644 --- a/src/pkg/reflect/value.go +++ b/src/pkg/reflect/value.go @@ -800,13 +800,15 @@ func (v Value) CanInterface() bool { return v.flag&(flagMethod|flagRO) == 0 } -// Interface returns v's value as an interface{}. +// Interface returns v's current value as an interface{}. +// It is equivalent to: +// var i interface{} = (v's underlying value) // If v is a method obtained by invoking Value.Method // (as opposed to Type.Method), Interface cannot return an // interface value, so it panics. // It also panics if the Value was obtained by accessing // unexported struct fields. -func (v Value) Interface() interface{} { +func (v Value) Interface() (i interface{}) { return valueInterface(v, true) }