From e03e7bf033d67e1077765826ccbb517bbae01849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Gill=C3=A9?= Date: Sat, 2 Mar 2024 15:08:57 +0100 Subject: [PATCH] Switch error check From old (not deprecated but discouraged) to new recommended one --- db.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db.go b/db.go index db56290..95cf337 100644 --- a/db.go +++ b/db.go @@ -2,7 +2,9 @@ package chromem import ( "context" + "errors" "fmt" + "io/fs" "os" "path/filepath" "sync" @@ -52,7 +54,7 @@ func NewPersistentDB(path string) (*DB, error) { } // If the directory doesn't exist, create it and return an empty DB. - if _, err := os.Stat(path); os.IsNotExist(err) { + if _, err := os.Stat(path); errors.Is(err, fs.ErrNotExist) { err := os.MkdirAll(path, 0o700) if err != nil { return nil, fmt.Errorf("couldn't create persistence directory: %w", err)