DEV Community

loading...

Discussion on: The Problem with Interfaces, and how Go Fixed it

Collapse
dean profile image
Dean Bassett Author

If an error happens on your part, it isn't Go's fault for being designed badly, it's most likely yours. In order to crash the system in your example, you need to put your Audio struct in a place called AnimatedGifVisualizer...

In Go, methods have very clear meaning about what they do. If you see a method that's called CloseThenExit(io.Closer) in an io library, would you really pass in your Door struct which has a Close() method?