isNil checks if a specified object is nil or not, without Failing.
(object interface{})
| 682 | |
| 683 | // isNil checks if a specified object is nil or not, without Failing. |
| 684 | func isNil(object interface{}) bool { |
| 685 | if object == nil { |
| 686 | return true |
| 687 | } |
| 688 | |
| 689 | value := reflect.ValueOf(object) |
| 690 | switch value.Kind() { |
| 691 | case |
| 692 | reflect.Chan, reflect.Func, |
| 693 | reflect.Interface, reflect.Map, |
| 694 | reflect.Ptr, reflect.Slice, reflect.UnsafePointer: |
| 695 | |
| 696 | return value.IsNil() |
| 697 | } |
| 698 | |
| 699 | return false |
| 700 | } |
| 701 | |
| 702 | // Nil asserts that the specified object is nil. |
| 703 | // |
no outgoing calls
no test coverage detected
searching dependent graphs…