Skip to content

Commit 92a87de

Browse files
committed
Fix func doc type
1 parent b7135ed commit 92a87de

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

docgen/docgen.go

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,7 @@ func (c *Context) use(t reflect.Type, ops ...option) *Type {
6969
// all embedded structs methods as well, no need to recursion.
7070
for i := 0; i < t.NumMethod(); i++ {
7171
m := t.Method(i)
72-
// Skip all protobuf generated methods as well.
73-
if strings.HasPrefix(m.Name, "XXX_") {
74-
continue
75-
}
76-
if isPrivate(m.Name) {
72+
if isPrivate(m.Name) || isProtobuf(m.Name) {
7773
continue
7874
}
7975
methods = append(methods, m)
@@ -142,6 +138,7 @@ func (c *Context) use(t reflect.Type, ops ...option) *Type {
142138
if t.NumOut() > 0 {
143139
f.Return = c.use(t.Out(0))
144140
}
141+
return f
145142
}
146143

147144
appendix:
@@ -162,18 +159,14 @@ appendix:
162159
}
163160

164161
for name, field := range conf.FieldsFromStruct(t) {
165-
// Skip all protobuf generated methods as well.
166-
if strings.HasPrefix(name, "XXX_") {
167-
continue
168-
}
169-
if isPrivate(name) {
162+
if isPrivate(name) || isProtobuf(name) {
170163
continue
171164
}
172165
a.Fields[Identifier(name)] = c.use(field.Type)
173166
}
174167

175168
for _, m := range methods {
176-
if isPrivate(m.Name) {
169+
if isPrivate(m.Name) || isProtobuf(m.Name) {
177170
continue
178171
}
179172
a.Fields[Identifier(m.Name)] = c.use(m.Type, fromMethod(true))
@@ -195,3 +188,7 @@ var isCapital = regexp.MustCompile("^[A-Z]")
195188
func isPrivate(s string) bool {
196189
return !isCapital.Match([]byte(s))
197190
}
191+
192+
func isProtobuf(s string) bool {
193+
return strings.HasPrefix(s, "XXX_")
194+
}

0 commit comments

Comments
 (0)