if rf, ok := dst.(ReaderFrom); ok {
return rf.ReadFrom(src)
}
> In Java for all its faults this wouldn’t happen because you’d be forced to implement all the interfaces. resource, err := newResource()
if err != nil {
return err
}
defer resource.Close()
IMO this pattern makes more sense, as calling exit behavior in most cases won't make sense unless you have acquired the resource in the first place.
The statement asserts that Bar struct pointers are assignable to a Foo interface.
I do agree it’s not as clean looking as the Java implements keyword, but it’s already a fairly terse pattern and IMO the inconvenience does not justify introducing new language syntax.