go-multierror

A Go library for combining multiple error values into a single, introspectable error.

Library
Go
vv1.1.1
2,581stars
Mozilla Public License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
51/100Fair
Development Activity28
Maintenance0
Community76
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
66/100Good
Architecture82
Code Quality78
Innovation40
Learning Curve65

go-multierror is a small HashiCorp-maintained Go package that represents a list of error values as a single error. It lets a function accumulate several failures during a multi-step operation and return them all as one value, instead of stopping at the first error or requiring a custom error type. Callers that don’t know about multierror still get a readable, formatted error string; callers that do can type-assert to *multierror.Error and access the underlying Errors slice directly.

The package is fully compatible with the standard library errors package, implementing Unwrap, Is, and As so that errors.Is/errors.As traverse each wrapped error correctly. It also ships a Group type for coalescing errors from concurrent goroutines, plus Append, Flatten, and Prefix helpers for building and reshaping error lists. As of Go 1.20, the standard library’s errors.Join covers the basic aggregation case, and the README explicitly recommends it for new projects — go-multierror remains relevant where custom formatting, the Group pattern, or the existing Append/Flatten/Prefix API surface are needed.

What You Get

  • Append(err, errs...) — builds or extends a *multierror.Error from any error value, flattening nested multierrors one level
  • *multierror.Error implementing the standard error interface plus Unwrap/Is/As for errors package interop
  • Customizable ErrorFormat function to control how the combined error renders as a string
  • Group — a sync.WaitGroup-backed helper that coalesces errors returned by concurrent goroutines
  • Flatten and Prefix helpers for merging nested multierrors and annotating every wrapped error with a common prefix

Common Use Cases

  • Running several independent validation checks and reporting all failures in one response instead of stopping at the first
  • Fanning work out across goroutines with Group and collecting every failure once all of them finish
  • Aggregating per-resource errors in infrastructure tooling (e.g. Terraform providers, HashiCorp tooling) where one API call touches many resources
  • Wrapping a batch of cleanup or teardown steps so callers can see everything that went wrong, not just the last error

Under The Hood

Architecture The package is a flat, single-package library with no internal boundaries: each file owns one orthogonal concern operating on the same *Error struct. multierror.go defines the core Error type (an Errors []error slice plus a pluggable ErrorFormat hook) along with its Error(), Unwrap(), GoString(), and WrappedErrors() methods, and a private chain type that makes errors.Is/errors.As traverse every wrapped error deterministically rather than only the first. append.go builds and flattens error lists one level deep, group.go layers a mutex-guarded sync.WaitGroup around Append for concurrent goroutine result collection, and format.go, flatten.go, prefix.go, and sort.go each add one composable utility. There is no dependency injection or external state; every function is a pure transformation of an error value, so the design surface is small and the core Error struct is the single point every other file depends on.

Tech Stack go.mod declares Go 1.13 as the minimum version and an empty go.sum — the library has zero third-party dependencies, relying only on the standard library (errors, fmt, strings, sync). A Makefile wraps go test, and CI (.github/workflows/go-multierror.yml) runs a go fmt check plus the test suite on every push and pull request, with a separate actionlint.yml workflow linting the GitHub Actions files themselves. As a leaf library with no runtime dependencies, it’s consumed purely via go get with no deployment or database concerns of its own.

Code Quality Every source file has a matching _test.go counterpart (covering Error, Append, Group, ListFormatFunc, Flatten, Prefix, and sort.Interface), written with the standard testing package and reflect.DeepEqual/t.Fatalf assertions rather than a third-party assertion library. Error handling is idiomatic Go — values are returned directly, and the core type explicitly implements Unwrap/Is/As so failures stay introspectable instead of being collapsed into strings. Naming is short and consistent (Append, Flatten, Prefix, Group), and CI enforces go fmt plus the full test suite, though there is no additional static-analysis linter (e.g. golangci-lint) configured beyond formatting.

What Makes It Unique go-multierror doesn’t introduce a novel error-handling model — it’s a straightforward “slice of errors wrapped in one error” pattern, and the README itself now points new projects at the standard library’s errors.Join (Go 1.20+) for the basic aggregation case, including a migration guide. What it still offers beyond stdlib is narrower but genuine: the Group helper for concurrent error collection (deliberately absent from errgroup, which returns only the first error), a configurable ErrorFormat for custom rendering, and Flatten/Prefix utilities with no direct standard-library equivalent.

Used by 14 apps in this directory

Go
75%
AGPL 3.0

Coder

Devops · Developer Tools · Code Editors

14,299

Self-hosted cloud development environments and AI coding agents — defined in Terraform, connected via WireGuard, automatically shut down when idle.

View details
93
Repo Health
90
Technical
69
Dependency
Built with
Go75%
TypeScript23%
Updated today
Go
92%
AGPL 3.0

Cozy Stack

File Storage · Productivity

1,270

Self-hosted personal cloud platform that unifies your files, apps, and devices in one private space you fully control.

View details
94
Repo Health
77
Technical
67
Dependency
Built with
Go92%
Updated 2 days ago
Go
31%
Apache 2.0

CubeSandbox

Developer Tools · Security · AI Agents

11,386

Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.

View details
82
Repo Health
88
Technical
63
Dependency
Built with
Go31%
Rust28%
C23%
Updated 2 days ago
Shell
48%
MIT

Dokku

Devops · Hosting Control Panel

32,114

The smallest PaaS implementation you've ever seen — deploy apps via git push using Docker and Heroku buildpacks on your own server.

View details
93
Repo Health
85
Technical
71
Dependency
Built with
Shell48%
Go48%
Updated today
TypeScript
49%
AGPL 3.0

Grafana

Monitoring · Analytics

76,498

The open-source observability platform that unifies metrics, logs, and traces from any data source into dynamic, queryable dashboards.

View details
95
Repo Health
91
Technical
65
Dependency
Built with
TypeScript49%
Go45%
Updated today
Go
61%
Apache 2.0

Harness Open Source

Developer Tools · Devops · Code Editors

38,169

A unified open source DevOps platform combining Git hosting, CI/CD pipelines, cloud development environments, and artifact registries in a single self-hosted system.

View details
89
Repo Health
79
Technical
64
Dependency
Built with
Go61%
TypeScript34%
Updated 2 days ago
Go
84%
MIT

Hatchet

AI Development · Developer Tools · Automation

7,812

A Postgres-backed orchestration engine for background tasks, AI agents, and durable workflows that replaces Redis queues and multi-datastore durable execution platforms with a single self-hostable service.

View details
88
Repo Health
83
Technical
68
Dependency
Built with
Go84%
PLpgSQL11%
Updated today
TypeScript
56%
MIT

Jitsu

Data Engineering

5,056

Open-source, fully-scriptable data ingestion engine that streams events from web, apps, and APIs to any data warehouse in real time.

View details
89
Repo Health
79
Technical
67
Dependency
Built with
TypeScript56%
Go42%
Updated yesterday
TypeScript
51%
Other

Mattermost

Team Chat · Collaboration · Devops

38,940

Open core, self-hosted team collaboration with chat, AI agents, voice calling, and deep DevOps integrations — all under your control.

View details
96
Repo Health
87
Technical
65
Dependency
Built with
TypeScript51%
Go40%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search