In the canonical example:
type Boat interface {
Launch()
}
func LaunchBoat(b Boat) {
// do some boat stuff
b.Launch()
}
type NuclearMissile struct{}
func (nm NuclearMissile) Launch() {
// launch nuclear missile
}
func main() {
rocket := NuclearMissile{}
LaunchBoat(rocket)
}
Sure, this compiles, but the code doesn't make any sense. Lots of things compile, that doesn't mean the code makes sense. At some point it's the programmer's responsibility to think a little.