You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When checking the type of a value, may occur that it can be nil, causing the program to crash. Iterating through a slice of interface and having a nil value can be a struggle.
There's many ways to solve this, but my propose is that reflect.TypeOf(nil).Kind() should returns nil.
I'm not sure this makes sense, but brought the topic to discuss.
The text was updated successfully, but these errors were encountered:
The
Kind()
method ofreflect.TypeOf()
returns the type of a given value, so this snippet panics:When checking the type of a value, may occur that it can be nil, causing the program to crash. Iterating through a slice of interface and having a nil value can be a struggle.
There's many ways to solve this, but my propose is that
reflect.TypeOf(nil).Kind()
should returnsnil
.I'm not sure this makes sense, but brought the topic to discuss.
The text was updated successfully, but these errors were encountered: