Dependency injection: Difference between revisions

Content deleted Content added
WikiCleanerBot (talk | contribs)
m v2.05b - Bot T20 CW#61 - Fix errors for CW project (Reference before punctuation)
Citation bot (talk | contribs)
Removed parameters. | Use this bot. Report bugs. | #UCB_CommandLine
Line 349:
 
=== Go ===
Go does not support classes and usually dependency injection is either abstracted by a dedicated library that utilizes [[Reflective programming|reflection]] or [[Generic programming|generics]] (the latter being supported since Go 1.18 <ref>{{Cite web |title=Go 1.18 Release Notes - The Go Programming Language |url=https://go.dev/doc/go1.18 |access-date=2024-04-17 |website=go.dev |language=en}}</ref>).<ref>{{Cite web |date=April 17, 2024 |title=Awesome Go – dependency injection |url=https://github.com/avelino/awesome-go?tab=readme-ov-file#dependency-injection |url-status=live |access-date=April 17, 2024 |website=Github}}</ref> A simpler example without using dependency injection libraries is illustrated by the following example of an [[Model–view–controller|MVC]] web application.
 
First, pass the necessary dependencies to a router and then from the router to the controllers: