gitwtfhub

wtf is wire?

google/wire — explained in plain English

Analysis updated 2026-06-24

14,386GoAudience · developerComplexity · 3/5Setup · moderate

TL;DR

Google's code generation tool for Go that reads how your program's components depend on each other and writes the boilerplate startup wiring code automatically.

Mindmap

mindmap
  root((Wire))
    What it does
      Dependency injection
      Code generation for Go
      Wires components at startup
    How it works
      Define provider functions
      Wire reads declarations
      Generates plain Go code
    Benefits
      No runtime reflection
      Readable output code
      Easy to test
    Status
      Feature complete
      Not actively maintained
      Fork to extend

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Eliminate hand-written dependency injection boilerplate in a Go application by letting Wire generate the startup wiring code from your provider declarations.

REASON 2

Make a Go application easier to test by having Wire produce explicit, readable connection code instead of relying on runtime reflection.

REASON 3

Understand the dependency graph of an existing Go project clearly because Wire's output is plain, readable Go code.

What's in the stack?

Go

How it stacks up

google/wireoauth2-proxy/oauth2-proxypanjf2000/ants
Stars14,38614,38114,413
LanguageGoGoGo
Setup difficultymoderatehardeasy
Complexity3/54/52/5
Audiencedeveloperops devopsdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · moderate Time to first run · 1h+

Feature-complete and no longer actively maintained, install the wire CLI separately and run it as a code-generation step in your build process.

Wtf does this do

Wire is a code generation tool for the Go programming language, created by Google, that solves a common problem in software development called dependency injection. Dependency injection is a technique where the pieces of a program are wired together explicitly, so each component receives the other components it needs rather than creating them itself or reaching for shared global variables. This makes programs easier to test and reason about, because the connections between parts are visible and explicit. The main job of Wire is to automate the repetitive work of writing that wiring code. You describe which components depend on which others, and Wire reads those descriptions and generates the Go code that sets everything up in the correct order at startup. Because Wire produces plain Go code, you can read and understand what it generates without any special tools, and it works without any runtime overhead or use of reflection (a technique where a program inspects its own structure at run time, which can be slower and harder to debug). Wire is considered feature-complete, meaning the core functionality is done and no new features are being added. The project's own README notes that it is no longer actively maintained, and users who want to extend it are directed to create their own fork (a personal copy of the project that they control). Bug reports and fixes were still accepted as of the last update, but new feature requests were not. The project is written in Go and is distributed as a command-line tool. Documentation including a tutorial, a user guide, and a best practices document are included in the repository. Community questions can be asked through GitHub Discussions.

Yoink these prompts

Prompt 1
I have a Go web server with a database connection, a repository layer, and HTTP handlers. Show me how to define Wire providers and generate the wiring code.
Prompt 2
How do I set up Wire in a Go project from scratch? Walk me through creating provider functions, a wire set, and running the wire command.
Prompt 3
My Go application has two implementations of an interface (real database and a mock). How do I use Wire to switch between them for testing vs production?

Frequently asked questions

wtf is wire?

Google's code generation tool for Go that reads how your program's components depend on each other and writes the boilerplate startup wiring code automatically.

What language is wire written in?

Mainly Go. The stack also includes Go.

How hard is wire to set up?

Setup difficulty is rated moderate, with roughly 1h+ to a first successful run.

Who is wire for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.