As I mentioned in the previous section, by adopting Wire we are hoping to see a significant reduction in the code and complexity in main(). We are also hoping to be able to essentially forget about the instantiation order of the dependencies by leaving the framework to handle it for us.
Applying off-the-shelf injection
Adopting Google Wire
The first thing we need to do, however, is to get our house in order. Most, if not all, of the objects we are going to let Wire handle use our *config.Config object, and currently it exists as a global singleton, as shown in the following code:
// App is the application config
var App *Config
// Load returns the config loaded from environment
func init() {
filename, found := os.LookupEnv...