Plus the lack of runtime control means you are essentially forced to do explicit DI, or you have an untestable mess. Hopefully the DI libs will catch up to e.g. Java's sophistication within a year or two.
Plus the lack of runtime control means you are essentially forced to do explicit DI, or you have an untestable mess. Hopefully the DI libs will catch up to e.g. Java's sophistication within a year or two.
And they have virtually nothing to do with DI?
If you are going to make an argument for more natural support for DI in go than other "strongly" typed languages it starts and ends with structural typing.
I don't even understand the basic premise of that argument. It seems nonsensical.
This isn't a killer feature, it jjust means Go requires less boilerplate when doing explicit DI, so the ROI offered by a DI framework is low. If you don't agree that initialization in Go requires less boilerplate, maybe you should be asking yourself what you gain from your DI framework?
They were originally intended to move the behavior changes provided by DI from compile time to configuration time.
This was especially valuable when you are delivering enterprise software to sites you don't control and you need to support a wide array of integrations.
They also happen to reduce boilerplate & DI can help with test-ability so they were adopted for that as well, but if you are only doing DI for tests and only using a framework to reduce lines of code it's a fairly widely accepted anti pattern.
I believe your basic assumptions about DI are wrong. The reason it hasn't taken off in the golang world is that the kind of software it was used for is less common & if you are writing it you'd not use golang for a host of reasons, none related to initializer syntax.
DI is also great for creating modular code you compose, instead of monoliths. It encourages the use of interfaces and information hiding - you should look into it, it's a very powerful technique.
Instead of asking how it would improve an arbitrary library, ask yourself "how screwed am I if 100% of the API surface for this library changes tomorrow?" Dependency injection would help you out of that faster that rewriting everything.