Skip to content

Commit 72c1c0d

Browse files
committed
support pointer of enum types.
1 parent f73e7db commit 72c1c0d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/generators/enum.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ func newEnumContext(c *generator.Context) *enumContext {
5555
// If the given type is a known enum type, returns the enumType, true
5656
// Otherwise, returns nil, false
5757
func (ec *enumContext) EnumType(t *types.Type) (enum *enumType, isEnum bool) {
58+
// if t is a pointer, use its underlying type instead
59+
if t.Kind == types.Pointer {
60+
t = t.Elem
61+
}
5862
enum, ok := ec.enumTypes[t.Name]
5963
return enum, ok
6064
}

0 commit comments

Comments
 (0)