Struct field and interface in Golang make it great to have dependencies injection. However, making out a deep-layered and highly customize configuration with dependencies injection would make it a hard time. Auto dependencies injection would be great for me.

In the old day, I was using github.com/facebookgo/inject for auto DI. However, playing with reflection in Golang is really harmful to the performance and boot time. If a long boot time would be acceptable, then I would just go with Spring and its DI.

Recently, I came across with github.com/google/wire. The dependencies injection is done at compile time. It makes use of the go parser for understanding the type to inject in the placeholder function with a different tag of wireinject and generate out the real function with non wireinject tag. It provides a good runtime performance and way for easy to debug and trace in the injection process.

wire is also used in go-cloud, a project by Google for enabling access different cloud in one interface. I think I will use wire for project in current.