On Thu, Jun 1, 2023 at 11:48 AM christoph...@gmail.com
<christophe.mees...@gmail.com> wrote:
>
> I have a method that receives a reflect.Value as input argument.
>
> When the method is given the argument reflect.ValueOf(nil), the methods 
> Type(), IsNil(), or IsZero() panic. For instance, when I call the method 
> IsZero() I see the panic message "panic: reflect: call of 
> reflect.Value.IsZero on zero Value " :)
>
> Is there a way to detect that the method was given a reflect.ValueOf(nil) ?

https://pkg.go.dev/reflect#Value.IsValid

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXz7ydS%3DEvKRDxy2CYhxEvSvwKDyBPey%2BTuGVysQ_Ns9g%40mail.gmail.com.

Reply via email to