Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There are two main reasons:

1. Many developers learn the print funcs before they really start paying attention to errors as return values, and so never think to check what it returns.

2. If println is failing, things are going very wrong. It would probably be more ergonomic to just have it panic in most cases, because if it errors out then what are you honestly going to do to recover gracefully? Just let your surrounding infrastructure handle it, whether that's restarting the process, starting a new container somewhere else on the cluster, or whatever.



If stdout is unavailable, should that really be fatal? Perhaps it should be considered an unusual equivalent to piping to /dev/null.


Which is the current practice of ignoring errors from `fmt.Println()`.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: