extract embedded field name so, for a struct like type A struct { io.Writer } we want "Writer"
(f ast.Expr)
| 647 | // |
| 648 | // we want "Writer" |
| 649 | func embedded(f ast.Expr) string { |
| 650 | switch f := f.(type) { |
| 651 | case *ast.Ident: |
| 652 | return f.Name |
| 653 | case *ast.StarExpr: |
| 654 | return embedded(f.X) |
| 655 | case *ast.SelectorExpr: |
| 656 | return f.Sel.Name |
| 657 | default: |
| 658 | // other possibilities are disallowed |
| 659 | return "" |
| 660 | } |
| 661 | } |
| 662 | |
| 663 | // stringify a field type name |
| 664 | func stringify(e ast.Expr) string { |
no outgoing calls
no test coverage detected
searching dependent graphs…