logoalt Hacker News

9rxlast Thursday at 6:29 PM0 repliesview on HN

> Go type-erases error types

That's clearly not true.

    type MyError struct{}
    func (MyError) Error() string { return "MyError" }

    func main() {
        var err error = MyError{}
        fmt.Printf("%T\n", err) // Output: main.MyError
    }
The idea doesn't even make any sense. How could you even begin to handle errors in a meaningful way if you were unable to discern what type the error is?