Is there a better dependency injection pattern in golang?
问题 Given this code: package main import ( "fmt" ) type datstr string type Guy interface { SomeDumbGuy() string } func (d *datstr) SomeDumbGuy() string { return "some guy" } func someConsumer(g Guy) { fmt.Println("Hello, " + g.SomeDumbGuy()) } func main() { var d datstr someConsumer(&d) } Is the wiring of components together that's done in main the right way to wire a dependency together? It seems like I'm over using this a bit in my code. Is there a common pattern better than this, or am I