3
0
corteza/pkg/minions/interface.go
Tomaž Jerman 104bfb23de Update Envoy for new/extended resources
* Reports
* API GW
* Module field; user role filter
* Comment page block
2021-09-22 11:38:35 +02:00

19 lines
417 B
Go

package minions
import "reflect"
// IsNil checks if the given interface is truly nil
//
// Due to how interfaces are handled under-the-hood, a simple i == nil may
// not always be ok.
func IsNil(i interface{}) bool {
if i == nil {
return true
}
switch reflect.TypeOf(i).Kind() {
case reflect.Ptr, reflect.Map, reflect.Array, reflect.Chan, reflect.Slice:
return reflect.ValueOf(i).IsNil()
}
return false
}