diff --git a/rendering/named_type.go b/rendering/named_type.go index ece6c90..1b2e404 100644 --- a/rendering/named_type.go +++ b/rendering/named_type.go @@ -17,6 +17,13 @@ func NewNamedType(name string, t Type) NamedType { } } +func NewDefinedType(name string) NamedType { + return NamedType{ + Name: name, + Type: Interface{}, + } +} + func (nt NamedType) Expr() ast.Expr { return ast.NewIdent(nt.Name) } diff --git a/rendering/type.go b/rendering/type.go index 1100fac..89a1873 100644 --- a/rendering/type.go +++ b/rendering/type.go @@ -27,7 +27,7 @@ func NewType(t types.Type) Type { name = fmt.Sprintf("%s.%s", pkg.Name(), obj.Name()) } - return NewNamedType(name, NewType(t.Underlying())) + return NewDefinedType(name) case *types.Interface: return Interface{}