1
0
mirror of https://github.com/MontFerret/ferret.git synced 2024-12-14 11:23:02 +02:00
ferret/pkg/runtime/core/helpers.go
2018-09-18 16:42:38 -04:00

26 lines
388 B
Go

package core
import "reflect"
func IsNil(input interface{}) bool {
val := reflect.ValueOf(input)
kind := val.Kind()
switch kind {
case reflect.Ptr,
reflect.Array,
reflect.Slice,
reflect.Map,
reflect.Struct,
reflect.Func,
reflect.Interface,
reflect.Chan,
reflect.UnsafePointer:
return val.IsNil()
case reflect.Invalid:
return true
default:
return false
}
}