Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/os/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func ExampleWriteFile() {

func ExampleMkdir() {
err := os.Mkdir("testdir", 0750)
if err != nil && !os.IsExist(err) {
if err != nil && !errors.Is(err, fs.ErrExist) {
log.Fatal(err)
}
err = os.WriteFile("testdir/testfile.txt", []byte("Hello, Gophers!"), 0660)
Expand Down Expand Up @@ -365,7 +365,7 @@ func ExampleUserConfigDir() {
configPath = filepath.Join(dir, "ExampleUserConfigDir", "example.conf")
var err error
origConfig, err = os.ReadFile(configPath)
if err != nil && !os.IsNotExist(err) {
if err != nil && !errors.Is(err, fs.ErrNotExist) {
// The user has a config file but we couldn't read it.
// Report the error instead of ignoring their configuration.
log.Fatal(err)
Expand Down