Comment

Comment by karmakaze

It's no surprise. The example is ignoring the error from casting. It should be:

  if quacker, ok := duck.(interface { Quack() }); ok {
    quacker.Quack()
  }
Ignoring errors leads to unexpected results.

Failing to mention that it's purposely ignoring an error for a fun blog post is the opposite of informative.

parent karmakaze 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton