Warning
The original google/wire project is no longer maintained. It was archived again
on August 25, 2025 after a brief unarchiving period, and it is now completely
unmaintained.
This is a version maintained by wireinject/wire.
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 install github.com/wireinject/wire/cmd/wire@latestand ensuring that $GOPATH/bin is added to your $PATH.
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.
Maintenance is now handled by wireinject/wire, with a deliberately narrow scope:
- We fix bugs, including compatibility problems with new Go toolchains and their dependencies.
- We add small, scoped features when they are clearly useful and low-risk.
- We do not overhaul the project. The core design, public API, and command-line
interface stay compatible with
google/wire. - We do not modify the golden tests that pin the generated output. The code
wireproduces for existing projects keeps working exactly as before.
Stability comes first: every change is weighed against the risk it poses to existing users.
For questions, please use GitHub Discussions.
This project is covered by the Go Code of Conduct.