mirror of
https://github.com/MontFerret/ferret.git
synced 2025-12-13 22:55:40 +02:00
Hello world
This commit is contained in:
25
pkg/runtime/core/helpers.go
Normal file
25
pkg/runtime/core/helpers.go
Normal file
@@ -0,0 +1,25 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user