From 7c659d1820a2fd7ab8513735951d82f0cdad225f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6ran=20Karl?= <3951388+JoeKar@users.noreply.github.com> Date: Sun, 12 May 2024 13:02:09 +0200 Subject: [PATCH] backup: Convert `os.IsNotExist()` into `errors.Is()` --- internal/buffer/backup.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/buffer/backup.go b/internal/buffer/backup.go index a043651e..0e254053 100644 --- a/internal/buffer/backup.go +++ b/internal/buffer/backup.go @@ -1,8 +1,10 @@ package buffer import ( + "errors" "fmt" "io" + "io/fs" "os" "path/filepath" "sync/atomic" @@ -73,7 +75,7 @@ func (b *Buffer) Backup() error { if backupdir == "" || err != nil { backupdir = filepath.Join(config.ConfigDir, "backups") } - if _, err := os.Stat(backupdir); os.IsNotExist(err) { + if _, err := os.Stat(backupdir); errors.Is(err, fs.ErrNotExist) { os.Mkdir(backupdir, os.ModePerm) }