@@ -69,11 +69,7 @@ func (c *Context) use(t reflect.Type, ops ...option) *Type {
69
69
// all embedded structs methods as well, no need to recursion.
70
70
for i := 0 ; i < t .NumMethod (); i ++ {
71
71
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 ) {
77
73
continue
78
74
}
79
75
methods = append (methods , m )
@@ -142,6 +138,7 @@ func (c *Context) use(t reflect.Type, ops ...option) *Type {
142
138
if t .NumOut () > 0 {
143
139
f .Return = c .use (t .Out (0 ))
144
140
}
141
+ return f
145
142
}
146
143
147
144
appendix:
@@ -162,18 +159,14 @@ appendix:
162
159
}
163
160
164
161
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 ) {
170
163
continue
171
164
}
172
165
a .Fields [Identifier (name )] = c .use (field .Type )
173
166
}
174
167
175
168
for _ , m := range methods {
176
- if isPrivate (m .Name ) {
169
+ if isPrivate (m .Name ) || isProtobuf ( m . Name ) {
177
170
continue
178
171
}
179
172
a .Fields [Identifier (m .Name )] = c .use (m .Type , fromMethod (true ))
@@ -195,3 +188,7 @@ var isCapital = regexp.MustCompile("^[A-Z]")
195
188
func isPrivate (s string ) bool {
196
189
return ! isCapital .Match ([]byte (s ))
197
190
}
191
+
192
+ func isProtobuf (s string ) bool {
193
+ return strings .HasPrefix (s , "XXX_" )
194
+ }
0 commit comments