go - Finding functions that return a specific type -


perhaps silly question, there way find functions (in standard library or gopath) return specific type?

for example there many functions take io.writer argument. want know how create io.writer , there many ways so. how can find ways without guessing @ packages , looking through methods find return io.writer (or whatever other type i'm after)?

edit: should extend question find types implement specific interface. sticking io.writer example (which admittedly bad example original question) have way find types implement writer interface, since types valid arguments function takes takes io.writer , answer original question when type interface.

in days coding i'm rare in need find functions returning int16 , error(func can return few values in go, know)

for second part of question there exists wonderful cmd implements written dominik honnef go honnef.co/go/implements after discover type satisfy conditions can assume constructor type (something func newthetype() thetype) after thetype declaration in source code , docs. it's proven go practice.


Popular posts from this blog