(p any)
| 6 | ) |
| 7 | |
| 8 | func Interface(p any) any { |
| 9 | if p == nil { |
| 10 | return nil |
| 11 | } |
| 12 | |
| 13 | v := reflect.ValueOf(p) |
| 14 | |
| 15 | for v.Kind() == reflect.Ptr || v.Kind() == reflect.Interface { |
| 16 | if v.IsNil() { |
| 17 | return nil |
| 18 | } |
| 19 | v = v.Elem() |
| 20 | } |
| 21 | |
| 22 | if v.IsValid() { |
| 23 | return v.Interface() |
| 24 | } |
| 25 | |
| 26 | panic(fmt.Sprintf("cannot dereference %v", p)) |
| 27 | } |
| 28 | |
| 29 | func Type(t reflect.Type) reflect.Type { |
| 30 | if t == nil { |
searching dependent graphs…