Skip to content
 
 

Repository files navigation

Wire: Automated Initialization in Go

Build Status godoc

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.

Installing

Install Wire by running:

go install github.com/wireinject/wire/cmd/wire@latest

and ensuring that $GOPATH/bin is added to your $PATH.

Documentation

Project status

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 wire produces for existing projects keeps working exactly as before.

Stability comes first: every change is weighed against the risk it poses to existing users.

Community

For questions, please use GitHub Discussions.

This project is covered by the Go Code of Conduct.

About

Compile-time Dependency Injection for Go

Topics

Resources

Code of conduct

Contributing

Stars

27 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages