Closed XiaoMouR closed 5 years ago
In this case, rev.Type
is *ast.StarExpr, which makes type assert failed.
I met the same problem.But it can be solved by replacing the corresponding codes with codes below. It is truly a fatal bug because of the plenty use of starExpr. for _, rec := range d.Recv.List { 156 s, ok := rec.Type.(fmt.Stringer) 157 if !ok { 158 if se,ok:=rec.Type.(*ast.StarExpr);ok{ 159 s,ok=se.X.(fmt.Stringer) 160 if !ok { 161 fmt.Println("NOstringer",rec.Type,reflect.TypeOf(se.X)) 162 continue 163 } 164 }else{ 165 fmt.Println("NOstringer",rec.Type,reflect.TypeOf(rec.Type)) 166 continue 167 } 168 169 }
It seems the struct's methods like follows won't be obfuscated.
I found that in methodRenames, type assert
rev.Type.(fmt.Stringer)
returns false