mirror of
https://github.com/Hopiu/micro.git
synced 2026-03-17 06:20:28 +00:00
bindings: Convert os.IsNotExist() into errors.Is()
This commit is contained in:
parent
42ae05b082
commit
5aac42dbe7
1 changed files with 2 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
|
@ -24,7 +25,7 @@ var Binder = map[string]func(e Event, action string){
|
|||
}
|
||||
|
||||
func createBindingsIfNotExist(fname string) {
|
||||
if _, e := os.Stat(fname); os.IsNotExist(e) {
|
||||
if _, e := os.Stat(fname); errors.Is(e, fs.ErrNotExist) {
|
||||
ioutil.WriteFile(fname, []byte("{}"), 0644)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue