On Fri, 27 Apr 2018 22:06:07 -0700 (PDT)
k1atti...@gmail.com wrote:

> How can i get a list of types which implement a particular interface ? ( 
> for exmaple io.Reader)

By using a tool named 'guru'. 

http://golang.org/s/using-guru
https://godoc.org/golang.org/x/tools/cmd/guru

Unlike in (almost?) all other languages in Go you need not to declare you
are about to implement an Interface. The 'implementing Interface' in Go means
that  your data object (struct) has a named method to call. Then any other
function may declare that it takes an 'Interface' parameter - so it may
**call** specified methods.

Any object with a method: 'Read([]byte) (int, error)' fulfills Reader
interface. When your object with above Read method is passed as parameter
to some function said function need not to know **anything** else about
said object but "I can call Read([]byte) (int, error)" on it.

You may use guru to know who implements what, but this information
is usually irrelevant and is not needed to write go programs. You look
at an Interface declaration - in Go usually not more than two or three
function signatures - then look at object of interest whether it has
methods with given by Interface signatures.

> Thank you in advance 
> Attila

-- 
Wojciech S. Czarnecki
 << ^oo^ >> OHIR-RIPE

-- 
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.

Reply via email to