isNil checks if a specified object is nil or not, without Failing.
(object interface{})
| 716 | |
| 717 | // isNil checks if a specified object is nil or not, without Failing. |
| 718 | func isNil(object interface{}) bool { |
| 719 | if object == nil { |
| 720 | return true |
| 721 | } |
| 722 | |
| 723 | value := reflect.ValueOf(object) |
| 724 | switch value.Kind() { |
| 725 | case |
| 726 | reflect.Chan, reflect.Func, |
| 727 | reflect.Interface, reflect.Map, |
| 728 | reflect.Ptr, reflect.Slice, reflect.UnsafePointer: |
| 729 | |
| 730 | return value.IsNil() |
| 731 | } |
| 732 | |
| 733 | return false |
| 734 | } |
| 735 | |
| 736 | // Nil asserts that the specified object is nil. |
| 737 | // |
no outgoing calls
no test coverage detected