Ask a Go developer what they’d change about the language, and “error handling” shows up near the top more often than almost anything else. The repetitive if err != nil { return err } pattern is the most-mocked feature of Go’s syntax — and also a direct, deliberate consequence of a design decision the Go team made at the language’s birth and has, after years of public debate, formally decided not to revisit.
At a Glance
| Question | Answer |
|---|---|
| Does Go have exceptions? | No. Go has panic/recover for truly exceptional, non-recoverable situations, but idiomatic error handling uses ordinary return values |
| What is an error in Go? | Any value implementing the built-in error interface: a single method, Error() string |
| Standard library helpers | errors.New, errors.Is, errors.As (both since Go 1.13), errors.Unwrap (Go 1.13), errors.Join (Go 1.20) |
| Was a “try” shorthand added? | No — the built-in try proposal (#32437) was proposed and then withdrawn by its own authors in 2019 after strong public pushback |
| Current official stance | The Go team has stopped pursuing syntactic changes to error handling “for the foreseeable future” and is closing related proposals |
Short Verdict
Go treats errors as values, not control flow. That’s a feature, not an oversight: the official Go blog argues explicit error checks keep failure handling visible at the call site rather than hidden behind a try/catch block that can silently skip over code. The cost is verbosity. After nearly a decade of proposals to fix that verbosity with new syntax — including a built-in try function and a ?-operator idea — the Go team has formally given up on a syntactic fix and instead keeps investing in library-level tools: errors.Is, errors.As, and errors.Join.
Why Go Doesn’t Use Exceptions
The error type is just a built-in interface:
type error interface {
Error() string
}
Any type that implements that one method satisfies it, which is why Go functions that can fail conventionally return an error as their last value, and callers are expected to check it immediately:
f, err := os.Open("config.json")
if err != nil {
return fmt.Errorf("loading config: %w", err)
}
defer f.Close()
The official Go blog’s rationale is that this keeps the failure path visible at the exact place it can occur, instead of letting it propagate silently up through a call stack the way a thrown exception can. The trade-off the language accepts in exchange is the repetition critics point to — the same three lines, over and over, in almost every function that does I/O.
The Toolkit: Is, As, and Join
Rather than adding new syntax, the standard library has grown targeted helpers for the hard parts of value-based error handling:
errors.Is(err, target)(Go 1.13) — reports whether a specific sentinel error (likeio.EOF) appears anywhere in err’s wrapped chain, even through multiple layers offmt.Errorf("...: %w", err)wrapping.errors.As(err, &target)(Go 1.13) — finds the first error in the chain matching a specific type and, if found, assigns it into target so you can read fields or call methods on it.errors.Join(err1, err2, ...)(Go 1.20) — combines multiple errors into one, useful when a function needs to report that several independent operations failed rather than just the first one. It discards nil values and returns nil if everything passed in is nil.
var ErrNotFound = errors.New("not found")
func lookup(id string) error {
return fmt.Errorf("lookup %s: %w", id, ErrNotFound)
}
err := lookup("42")
if errors.Is(err, ErrNotFound) {
// handle the specific case, even though err's message
// is "lookup 42: not found", not the sentinel itself
}
Why “try” Didn’t Survive
In 2019, the Go team formally proposed a built-in try function (Go issue #32437) that would let a call like try(f()) return early from the enclosing function automatically on error, cutting the three-line pattern down to one. The proposal arrived close to a finished design with an aggressive rollout timeline, and the community reaction was strongly negative — critics argued it hid control flow (an early return) inside what looked like a normal expression, buried arbitrarily deep in a line of code. The Go team withdrew it within weeks.
That wasn’t the end of the conversation — a later community proposal for a ? operator (similar to Rust’s) got the same scrutiny. In the Go blog’s own account, neither that nor any other syntactic proposal reached anything resembling consensus, which under Go’s proposal process means decline. The Go team’s current, explicit position: it is done pursuing syntax changes for error handling “for the foreseeable future” and is closing related proposals, while acknowledging that the verbosity complaint remains one of the most common pieces of Go feedback.
Pros and Cons of Go’s Approach
- Pros: Every point where a function can fail is visible and explicit in the code; no hidden stack unwinding; errors can carry structured data via custom types, not just a message string;
errors.Is/errors.As/errors.Joinhandle the common wrapping and multi-error cases without new syntax - Cons: Genuinely more boilerplate than exception-based languages for functions with several fallible calls in a row; no built-in shorthand, and the Go team has ruled one out for now; easy to accidentally ignore an error by not checking it (though linters like
errcheckcatch this)
Bottom Line
Go’s error handling isn’t an unfinished feature waiting for new syntax — it’s a settled design position, reaffirmed after years of public proposals that never reached consensus. If you’re coming from an exception-based language, the repetition is real, but the standard library’s errors.Is, errors.As, and errors.Join cover the cases that actually trip people up (wrapped sentinel errors, typed errors, multiple simultaneous failures) without requiring a language change.
FAQ
Does Go have any exception-like mechanism at all?
Yes — panic and recover — but idiomatic Go reserves these for truly unrecoverable programmer errors (like an out-of-bounds slice access), not for ordinary, expected failure conditions like a missing file or a failed network call.
Is the “try” proposal completely dead?
As of the Go team’s own blog post on the subject, yes — they’ve stated they’re not pursuing error-handling syntax changes for the foreseeable future and are closing related proposals, including follow-ons like the “?” operator idea.
What’s the difference between errors.Is and errors.As?errors.Is checks whether a specific known error value appears in the chain (useful for sentinel errors like io.EOF). errors.As checks whether an error of a specific type appears in the chain and extracts it so you can access its fields.
