Hacker News new | ask | show | jobs
by chrsm 2689 days ago
The real issue here is that it is not immediately obvious that this is actually an interface - one expects the second `err` to be *FormatError due to the signature - it happens to implement the error interface so it goes unnoticed.

Shadowing in a different scope allows it to work properly as well.

I admit that I've never actually run in to this issue in practice as I generally return custom errors as `error`, but I can see why it would confuse someone.

1 comments

Totes.