# uber-go/gopatch

Refactoring and code transformation tool for Go.

Repository: https://github.com/uber-go/gopatch
Canonical: https://ross.abutalabs.com/products/gopatch
Language: Go
License: MIT
License Family: permissive
Topics: golang, refactoring, go
Last push: 2025-02-11T08:36:20+00:00

## Health v2 (maintenance only)
Score: 26/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 6, release rhythm 8, longevity 100
- inputs: {"age_days": 2102, "days_push": 568, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1039, forks 42 (observed 2026-08-28T04:03:19.944988+00:00)

## What it is
gopatch is a command-line tool for matching and transforming Go source code using patch files that understand Go syntax. It operates like the Unix patch tool but performs AST-aware refactoring and restyling rather than plain text substitution.

## Use cases
- automate refactoring across a large Go codebase
- replace errors.New(fmt.Sprintf(...)) with fmt.Errorf everywhere
- write custom lint autofixes as patch files
- enforce code style changes in Go projects
- apply syntax-aware bulk code transformations
- codify recurring code migration patterns

## When to choose
- you need to make repetitive structural changes across many Go files
- you want to encode team style fixes as reusable patch files
- text-based sed/patch is too fragile because you need Go syntax awareness

## When to avoid
- you work in languages other than Go
- you need one-off simple text substitutions that sed handles fine
- you need full IDE-integrated interactive refactoring

## Facets
- artifact type: cli-tool
- maturity: active
- function: developer-tools, parser, formatter
- domain: developer-tools, programming-languages
- platform: windows, cli, go
- tags: go, refactoring, code-transformation, ast, patch, static-analysis, automation, linux, macos

## Member repositories
- uber-go/gopatch (main) score 26

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:19.944988+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T07:03:55.925057+00:00, confidence not recorded.
  - readme: https://github.com/uber-go/gopatch (fetched 2026-08-28T04:03:19.944988+00:00, sha 94b35f8d865d)
- Data as of 2026-08-30T08:39:29.467469+00:00.
