Plurrrr

Sun 05 Apr 2020

Dependency Injection in Go using Fx

But as your software grows, you start feeling the growing pains – your main function starts becoming more and more convoluted. You start having all sorts of small bits and pieces plugged in here and there – healthchecks, database setup code, metrics, tracers, external API connections, etc etc.

And what if your application grows into a microservice architecture? What do you do when you have five different microservices demanding the same bunch of setup code, specific to your environment?

In this article, I will introduce you to Fx. It’s a Go framework which solves both problems outlined above using dependency injection.

Source: Dependency Injection in Go using Fx, an article by Preslav Mihaylov.