I need an io.Writer for a function. I don't know how to get one from a file...
I know interface are implicit so it complicated the search...
I need an io.Writer for a function. I don't know how to get one from a file...
I know interface are implicit so it complicated the search...
Look at the os.File documentation: it has a func (*File) Write
method, which means it is a Writer.
You can use the command guru
to list all types implementing an interface.
Notably, the implements
query:
The implements query shows interfaces that are implemented by the selected type and, if the selected type is itself an interface, the set of concrete types that implement it.
An implements query on a value reports the same information about the expression’s type.
An implements query on a method shows the set of abstract or concrete methods that are related to it