# Golang DI Notes [![](https://i.imgur.com/tkfpLrW.png)](https://cutt.ly/bndHJbJ) - https://cutt.ly/bndHJbJ ``` Class2 / Struct - DoA - DoB - DoC DoAer -> interface DoBer DoCer DoAImpl - class/struct Method(inf) Method(...) < must be restricted to 3 Method(Class2er) Class2 / Struct - DoA - DoB - DoC (Class2er) inf - DoAer - DoBer - DoCer - DoAImpl -> DoAer DI -> (DoAer <-> DoAImpl [Options IsOnetime]) NewClass2(DoAImpl,...) Di.Create<Class2>() Class2 / Struct --> how to refactor field DoAer, DoBer, DoCer NewClass2( DoAer, DoBer ) { DoAer = DoAer, .. } - DoA -> DoAer.DoA() // delegation - DoB -> Dober.Dob() // delegation - DoC .... // Go feature // vars.go var ( doAimpl = NewDoAImpl() doBimpl = NewDoAImpl() .. ) Class2 / Struct --> how to refactor { } NewClass2() { - DoA -> doAimpl.DoA() // delegation - DoB -> doBimpl .Dob() // delegation - DoC ```