I have an object like os.Stdout
and I want to know if it supports io.WriteCloser
on my platform. I can get the type of my object, but it doesn't tell me anything about interfaces.
package main
import ("fmt"; "reflect"; "os")
func main() {
fmt.Println(reflect.TypeOf(os.Stdout))
}
This code prints *os.File
to console.
I can manually lookup if os.File
matches io.WriteCloser
methods, but I am curious to know all interfaces that this object supports. Is that possible?
Aucun commentaire:
Enregistrer un commentaire