Get the latest tech news
Duck typing (horror) in Go
If you say Go supports “duck typing” online, you’ll probably get somepushback. The Go community often points out that Go doesn’t support duck typingbecause i...
Rather, Go has “structural typing” where interfaces are still implicitly implemented, but still checked at compile time. It is essentially the Go analogue of the Wikipedia duck typing example in Python. Of course, the “correct” implementation of the quack function would be to accept Duck instead of any and ditch the type assertion, which will result a compile time error:
Or read this on Hacker News