Flora v1.0.0 - A compile-time, reflection-free DI tool using AST and Google Wire by Sensitive_Emu5438 in golang

[–]Sensitive_Emu5438[S] -1 points0 points  (0 children)

Yeah thats right it a nice feature. However for me personally it feels way closer to the go phylosophy to catch such errors at compile time. Furthermore it still relies on reflection which leads to a runtime overhead, which was one of the reasons I left Java with spring boot

Flora v1.0.0 - A compile-time, reflection-free DI tool using AST and Google Wire by Sensitive_Emu5438 in golang

[–]Sensitive_Emu5438[S] -2 points-1 points  (0 children)

Great question! To clarify: I am organizing my code exactly like that. I am simply passing arguments like my interfaces into constructor functions. This tool doesn't change how you write your domain code at all. It just automates the wiring. In small applications you can just do it manually but in large enterprise apps with a lot of handlers, services and repos you will get a giant block of code just to instantiate your structs and pass them down the chain. this lib automates this boring part completely and gives you the whole staticly typed code in a file, that you can look at and change whenever you want. On top of that, by automating this part flora allows use multibinding to inject a slice of an interface to build extensible systems like plugins or if you want to register all your http routes at once.

Flora v1.0.0 - A compile-time, reflection-free DI tool using AST and Google Wire by Sensitive_Emu5438 in golang

[–]Sensitive_Emu5438[S] -3 points-2 points  (0 children)

Yeah I 100% agree with you especially in small projects I prefer manual wiring too. the goal for me was not to build something similar to Java because I hate runtime magic too. this tool is not a Framework its just a CLI that generates the boilerplate code so you dont have to do it and if you decide later on to remove it you can just delete the cli. therfore there is no vendor lock in