How to ensure a type implements an interface in Golang?
Sep 22, 2022
⋅
0 minutes read
To ensure that Rectangle
type implements the Shape
interface, we check it at compile time.
Compiling the code above gives us the following error:
Implementing the interface gets rid of the compile error