Posted on 25th April 2024
Dependency Injection means the view that your components which are usual structs within go should get their dependencies while being built. That runs counter over the associated anti-pattern like components making their private dependencies through initialization. Let us see at an example.
type Server struct {
config *Config
}
func New() *Server {
return &Server{
config: buildConfigAnyhow(),
}
}
STILL GOT QUERIES?