// NumMethod returns the number of exported methods in the value's method set.
func (v Value) NumMethod() int {
if v.typ == nil {
panic(&ValueError{"reflect.Value.NumMethod", Invalid})
}
if v.flag&flagMethod != 0 {
return 0
}
return v.typ.NumMethod()
}
Note that Value.NumMethod is documented to only return the number of exported methods. It calls Type.NumMethod, which is documented as:
// NumMethod returns the number of methods accessible using Method.
//
// Note that NumMethod counts unexported methods only for interface types.
Am I misreading the docs, or do they seem to disagree when it comes to interface types?
On e7d5857, I see:
Note that
Value.NumMethod
is documented to only return the number of exported methods. It callsType.NumMethod
, which is documented as:Am I misreading the docs, or do they seem to disagree when it comes to interface types?
cc @dsnet
cc @ianlancetaylor @mdempsky given some past changes regarding
NumMethods
and exported methodsThe text was updated successfully, but these errors were encountered: