Update #142
@@ -164,6 +164,16 @@ type genRunner struct {
//
// Library users: *DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE.*
func Gen(w io.Writer, buildTags, pkgName, uid string, useUnsafe bool, ti *TypeInfos, typ ...reflect.Type) {
+ // trim out all types which already implement Selfer
+ typ2 := make([]reflect.Type, 0, len(typ))
+ for _, t := range typ {
+ if reflect.PtrTo(t).Implements(selferTyp) || t.Implements(selferTyp) {
+ continue
+ }
+ typ2 = append(typ2, t)
+ typ = typ2
+
if len(typ) == 0 {
return
}