Many newer Go engineers fall into this trap, use this refactoring pattern to clean up errors so they happen at container startup, instead of waiting for a live HTTP request to fail.
Using this pattern we can extract errors to the earliest possible discovery time, and also help make parts of our code no longer return errors, removing a bunch of if err != nil checks, and error wrapping.
Using this pattern we can extract errors to the earliest possible discovery time, and also help make parts of our code no longer return errors, removing a bunch of if err != nil checks, and error wrapping.