I want to know how can I inject dependency flexibly in golang just like java spring, Which is if I want to change a instance of an interface all I have to do is just to change some config file.
First I want to find some function like getTypeByName(), so I can just give a struct name like "mypkg.structName" in config file and load that struct by the function, but it seems that there is no such function in golang.
And now the most doable way i can think is to create a loader model to generate a struct register file to load all custom struct.
But I want to know is there have a easier way to do that, all is there some golang-style way to implement this flexibility?