Thanks Axel for the detail explanation. Make sense now. :)
On Monday, December 5, 2016 at 12:51:41 PM UTC+5:30, Axel Wagner wrote:
>
> You need to distinguish between "the zero value of it's type" and "the
> zero (reflect.)Value". The docs here mean the latter, not the former.
> What is happening
You need to distinguish between "the zero value of it's type" and "the zero
(reflect.)Value". The docs here mean the latter, not the former.
What is happening is, that in case of a nil-interface (w and in), the
interface gets passed "as is" into reflect.ValueOf, which takes an
interface{}. That is,
On Mon, Dec 5, 2016 at 6:55 AM Kaviraj Kanagaraj
wrote:
> But still docs seems to be misleading. It says "If v is the zero Value
(IsValid returns false), Kind returns Invalid."
The docs are correct: https://play.golang.org/p/Wo0mryLeZ5
--
-j
--
You received this message because you are subs
Sry for the typo. Its true that Kind() returns "Invalid" if IsValid returns
False. But still docs seems to be misleading. It says "If v is the zero
Value (IsValid returns false), Kind returns Invalid."
according to doc, all the variables in the code supposed to have a kind of
"Invalid" (since a
On Sun, Dec 4, 2016 at 9:01 PM Kaviraj Kanagaraj
wrote:
> https://play.golang.org/p/wrVwCedf65
See https://play.golang.org/p/RoIAXsxhIF
--
-j
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving
doc for Value.Kind() says,
"If v is the zero Value (IsValid returns false), Kind returns Invalid."
but thats not true. I does return "Invalid" in case of interfaces. but not
for every type. It doesn't return "invalid" even if IsValid return false.
https://play.golang.org/p/wrVwCedf65
--
You