MCPcopy Create free account
hub / github.com/go-python/gopy / IfaceIsNil

Function IfaceIsNil

gopyh/handle.go:41–51  ·  view source on GitHub ↗

IfaceIsNil returns true if interface or value represented by interface is nil

(it interface{})

Source from the content-addressed store, hash-verified

39
40// IfaceIsNil returns true if interface or value represented by interface is nil
41func IfaceIsNil(it interface{}) bool {
42 if it == nil {
43 return true
44 }
45 v := reflect.ValueOf(it)
46 vk := v.Kind()
47 if vk == reflect.Ptr || vk == reflect.Interface || vk == reflect.Map || vk == reflect.Slice || vk == reflect.Func || vk == reflect.Chan {
48 return v.IsNil()
49 }
50 return false
51}
52
53// NonPtrValue returns the non-pointer underlying value
54func NonPtrValue(v reflect.Value) reflect.Value {

Callers 2

EmbedFunction · 0.85
RegisterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected