Hi everyone, I have some confusion about GO's interface: 1. Some different interface but with the same signature I have put an example here: https://github.com/vipally/glab/blob/master/lab12/walk_test.go The confusion is, there are two different interface filepath.Walker and pet.Walker. filepath.Walker is designed for "visit all files of a filepath" pet.Walker is designed for "walk action of animals" But unfortunately, both signature is the same: type Walker interface { Walk() }
But in go syntax, the follow usage is legal: var petWalker pet.Walker petWalker = &filepath.FilePath{} petWalker.Walk() But it's obviously that this usage is out of plan. 2. Cannot find all types that has implements an interface Go tools is hard to find type pet.Dog and pet.Cat through pet.Walker, Because there is no declarations of the relations between them. Maybe this outter-declaration can solve this problem? //declare which types has implements this interface implements pet.Walker{ *pet.Dog *pet.Cat } //declare this type has implement any interfaces implements *filepath.FilePath{ filepath.Walker filepath.Reader } Ally. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.