!+print Print prints the method set of the value x.
(x interface{})
| 15 | |
| 16 | // Print prints the method set of the value x. |
| 17 | func Print(x interface{}) { |
| 18 | v := reflect.ValueOf(x) |
| 19 | t := v.Type() |
| 20 | fmt.Printf("type %s\n", t) |
| 21 | |
| 22 | for i := 0; i < v.NumMethod(); i++ { |
| 23 | methType := v.Method(i).Type() |
| 24 | fmt.Printf("func (%s) %s%s\n", t, t.Method(i).Name, |
| 25 | strings.TrimPrefix(methType.String(), "func")) |
| 26 | } |
| 27 | } |
| 28 | |
| 29 |