Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This isn't exactly dependency injection, this is a dynamic scope. It does have some functional overlap with request scoping in Guice, but you could imagine a world in which you have both context propagation and dependency injection.

However, even on moderately complex Go projects, I have not yet found a need for dependency injection. It's major value in Java was testing, which is usually done another way in Go. (Fewer mocks, fewer fakes, more access to private package parts in tests.)

Context propagation on the other hand, has proven valuable. We get cancellation and timeouts that work reliably across RPC boundaries.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: