internal/testdata/fixtures/posts/with-code.md
---
title: Using errors.Is in Go
date: 2024-07-04
tags: [go, errors]
---
I learned today that `errors.Is` unwraps wrapped errors automatically.
package main
import (
"errors"
"fmt"
)
func main() {
a := errors.New("boom")
b := fmt.Errorf("wrapped: %w", a)
fmt.Println(errors.Is(b, a))
}
That prints `true`.