Creating a Google Cloud Pub/Sub client using the Singleton design pattern in Golang

Singleton Design Pattern is a creational design pattern used when only a single instance of a class or struct should exist. The lone instance is called the singleton object.

To demonstrate the design pattern in Golang, let's take the example of a pub/sub client where only one instance of the client should be created and it…