You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I add a new method to reflect.Type the api tool rejects it:
+pkg reflect, type Type interface { Align, AssignableTo, Bits, ChanDir, ConvertibleTo,
Elem, Field, FieldAlign, FieldByIndex, FieldByName, FieldByNameFunc, Implements, In,
IsVariadic, Key, Kind, Len, Method, MethodByName, Name, NumField, NumIn, NumMethod,
NumOut, Out, PkgPath, Size, String }
-pkg reflect, type Type interface { Align, AssignableTo, Bits, ChanDir, Elem, Field,
FieldAlign, FieldByIndex, FieldByName, FieldByNameFunc, Implements, In, IsVariadic, Key,
Kind, Len, Method, MethodByName, Name, NumField, NumIn, NumMethod, NumOut, Out, PkgPath,
Size, String }
However, this is okay as long as all the implementations in package reflect have been
updated to continue to implement the new interfaces, because Type has an unexported
method (or more), so there is no possibility that code outside reflect is trying to
implement this interface and will break because of the new method. Additions are okay,
deletions are not.
I suspect that the easiest fix is to say that for interfaces with unexported methods,
you list the exported ones one per line like we do for struct fields:
pkg reflect, type Type interface, method Align
...
As a counter-example test case, io.Reader would continue to use the existing 1-line
format.
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: