Go Design Pattern: Singleton
What is Singleton? The Singleton pattern is a design pattern that ensures a class has only one instance and provides a global access point to that instance. I will keep the post as simple as possible as our brain can process a little at a time (don’t know about yours, mine can’t). Let’s start with a scenario: Database connection You want to connect to the database of a service to fetch some information. You have to do the following: ...