From aefbccbfeabb3758390563a0b25db7c0a8c3ada9 Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Sat, 22 Jul 2023 18:59:33 +0300 Subject: [PATCH] replaced os.IsNotExists --- plugins/jsvm/jsvm.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/jsvm/jsvm.go b/plugins/jsvm/jsvm.go index 42159e6a..33e7f3bd 100644 --- a/plugins/jsvm/jsvm.go +++ b/plugins/jsvm/jsvm.go @@ -9,7 +9,9 @@ package jsvm import ( + "errors" "fmt" + "io/fs" "os" "path/filepath" "regexp" @@ -276,7 +278,7 @@ func (p *plugin) normalizeServeExceptions(oldErrorHandler echo.HTTPErrorHandler) // This method does nothing if the hooks directory is missing. func (p *plugin) watchHooks() error { if _, err := os.Stat(p.config.HooksDir); err != nil { - if os.IsNotExist(err) { + if errors.Is(err, fs.ErrNotExist) { return nil // no hooks dir to watch } return err @@ -413,7 +415,7 @@ func prependToEmptyFile(path, text string) error { func filesContent(dirPath string, pattern string) (map[string][]byte, error) { files, err := os.ReadDir(dirPath) if err != nil { - if os.IsNotExist(err) { + if errors.Is(err, fs.ErrNotExist) { return map[string][]byte{}, nil } return nil, err