Being a part of the tech industry, it would be good to share thoughts on specific technologies.
Having surrounded by skilled and experienced Golang developers, I have thought why not to share their thoughts in the community to utilise the information.
So, sharing an interesting topic on Golang.
Blogpost: Golang Error Handling- Way of Handling Errors
This blog outlines the basics of Golang Error Handling with examples and why is it having a better approach than other languages.
Do read this blogpost and understand how it is better than other languages, and a high overview of panic and recover mechanism.
Corresponding tweet for this thread:
Share link for this tweet.
Thanks for the blog, GoLang have support for errors in a really simple way. Go functions return errors as a second return value.
Doesn’t that mean that they are pretty trivial to accidentally (or purposefully) ignore? Sounds bad for maintainability? Plus what about issues like an error value able to be a slim pointer null, a fat pointer null (which won’t compare to null correctly), or an error itself? And what is the state of the first return value when the error has happened? Does it still contain useful information? Is it garbage? If it’s garbage then why does it exist at all? If it “depends on the call” then why isn’t that told by the types?
Just a tiny tiny sampling of reasons why every language need sum types. Just having prod types like structs is insufficient, need sum types as well, like variants.