diff options
Diffstat (limited to 'libgo/go/os/example_test.go')
-rw-r--r-- | libgo/go/os/example_test.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libgo/go/os/example_test.go b/libgo/go/os/example_test.go index 3adce51..e8554b0 100644 --- a/libgo/go/os/example_test.go +++ b/libgo/go/os/example_test.go @@ -5,6 +5,7 @@ package os_test import ( + "errors" "fmt" "io/fs" "log" @@ -71,9 +72,9 @@ func ExampleFileMode() { } } -func ExampleIsNotExist() { +func ExampleErrNotExist() { filename := "a-nonexistent-file" - if _, err := os.Stat(filename); os.IsNotExist(err) { + if _, err := os.Stat(filename); errors.Is(err, fs.ErrNotExist) { fmt.Println("file does not exist") } // Output: |