mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-25 18:07:07 +09:00
bindings: Convert os.IsNotExist() into errors.Is()
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/fs"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -24,7 +25,7 @@ var Binder = map[string]func(e Event, action string){
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createBindingsIfNotExist(fname 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)
|
ioutil.WriteFile(fname, []byte("{}"), 0644)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user