Skip to content

Commit 77dafd4

Browse files
authored
Changed os.IsNotExist to errors.Is
This change follows the Go Documentation found [here](https://pkg.go.dev/os#IsNotExist). This change also supports Go 1.13 and above.
1 parent f57835a commit 77dafd4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ import (
44
"flag"
55
"fmt"
66
"io/ioutil"
7+
"io/fs"
78
"os"
89
path "path/filepath"
910
"runtime"
1011
"strings"
12+
"errors"
1113

1214
"github.com/silenceper/log"
1315
)
@@ -103,7 +105,7 @@ func main() {
103105

104106
// init gowatch.yml
105107
if len(os.Args) > 1 && os.Args[1] == "init" {
106-
if _, err := os.Stat("gowatch.yml"); os.IsNotExist(err) {
108+
if _, err := os.Stat("gowatch.yml"); errors.Is(err, fs.ErrNotExist) {
107109
_ = ioutil.WriteFile("gowatch.yml", []byte(defaultYml), 0755)
108110
fmt.Println("gowatch.yml file created to the current directory with the default settings")
109111
} else {

0 commit comments

Comments
 (0)