Elegantly handle errors returned by deferred functions

As a GoLang developer you would have seen this code snippet very often: Code similar to the example snippet above is seen when dealing with resources like database connections and files. While nothing seems wrong with this code (there is really nothing wrong here to be honest), some of the IDEs or static analysis tools will report unhandled error warning on line There are different trains of thought on how to deal with this error. In most of the places, such errors can be safely ignored because they don’t matter. At other times, even if the error did matter, there …

Continue Reading