blob: 08d36acd535a1bde7c212de7600a602f139399d6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
//go:build go1.18
package errors_test
import (
"fmt"
"os"
"github.com/go-faster/errors"
)
func ExampleInto() {
_, err := os.Open("non-existing")
if err != nil {
if pathError, ok := errors.Into[*os.PathError](err); ok {
fmt.Println("Failed at path:", pathError.Path)
}
}
// Output:
// Failed at path: non-existing
}
|