Compile-time Dependency Injection for Go
Wire is a code generation tool that automates connecting components using dependency injection. Dependencies between components are represented in Wire as function parameters, encouraging explicit initialization instead of global variables. Because Wire operates without runtime state or reflection, code written to be used with Wire is useful even for hand-written initialization.
For an overview, see the introductory blog post.
Install Wire by running:
go get github.com/google/wire/cmd/wire
and ensuring that
$GOPATH/binis added to your
As of version v0.3.0, Wire is beta and is considered feature complete. It works well for the tasks it was designed to perform, and we prefer to keep it as simple as possible.
We'll not be accepting new features at this time, but will gladly accept bug reports and fixes.
For questions, please use GitHub Discussions.
This project is covered by the Go Code of Conduct.