blob: 01ef7cf8e5e474852043452f8f5c7b91fcffbf16 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
|
//go:build go1.18
package errors
// Into finds the first error in err's chain that matches target type T, and if so, returns it.
//
// Into is type-safe alternative to As.
func Into[T error](err error) (val T, ok bool) {
ok = As(err, &val)
return val, ok
}
|