Get the latest tech news
Go: Sentinel errors and errors.Is() slow your code down by 3000%
An exhaustive set of benchmarks on different ways to approach error handling in Golang. We demonstrate that common sentinel error idioms are slow your code down by 30x.
But in the (usually more common) case when the value is found, it's much better than starting with a direct error constant comparison, performing just as well as the boolean strategy. Earlier this month I kicked the hornet's nest by suggesting that you shouldn't name boolean map check variables ok. Going back further, lots of luminaries and philosophers in the field have given the same advice in other contexts and for other languages: don't use errors for control flow.
Or read this on Hacker News