Skip to content

Commit c1a2a24

Browse files
committed
Updated to use the new fsnotify
This introduces a lot of bugfixes in that tool in the last 5 years!
1 parent c5a3351 commit c1a2a24

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/silenceper/gowatch
33
go 1.14
44

55
require (
6-
github.com/howeyc/fsnotify v0.9.0
6+
github.com/fsnotify/fsnotify v1.5.1
77
github.com/mitchellh/go-ps v1.0.0
88
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
99
github.com/silenceper/log v0.0.0-20171204144354-e5ac7fa8a76a

go.sum

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
github.com/howeyc/fsnotify v0.9.0 h1:0gtV5JmOKH4A8SsFxG2BczSeXWWPvcMT0euZt5gDAxY=
2-
github.com/howeyc/fsnotify v0.9.0/go.mod h1:41HzSPxBGeFRQKEEwgh49TRw/nKBsYZ2cF1OzPjSJsA=
1+
github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
2+
github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
33
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
44
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
55
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
@@ -9,6 +9,8 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWb
99
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
1010
github.com/silenceper/log v0.0.0-20171204144354-e5ac7fa8a76a h1:COf2KvPmardI1M8p2fhHsXlFS2EXSQygbGgcDYBI9Wc=
1111
github.com/silenceper/log v0.0.0-20171204144354-e5ac7fa8a76a/go.mod h1:nyN/YUSK3CgJjtNzm6dVTkcou+RYXNMP+XLSlzQu0m0=
12+
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
13+
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1214
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
1315
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
1416
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0 h1:POO/ycCATvegFmVuPpQzZFJ+pGZeX22Ufu6fibxDVjU=

gowatch.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"strings"
1212
"time"
1313

14-
"github.com/howeyc/fsnotify"
14+
"github.com/fsnotify/fsnotify"
1515
"github.com/mitchellh/go-ps"
1616
"github.com/silenceper/log"
1717
)
@@ -33,7 +33,7 @@ func NewWatcher(paths []string, files []string) {
3333
go func() {
3434
for {
3535
select {
36-
case e := <-watcher.Event:
36+
case e := <-watcher.Events:
3737
isbuild := true
3838

3939
// Skip ignored files
@@ -66,7 +66,7 @@ func NewWatcher(paths []string, files []string) {
6666
Autobuild(files)
6767
}()
6868
}
69-
case err := <-watcher.Error:
69+
case err := <-watcher.Errors:
7070
log.Errorf("%v", err)
7171
log.Warnf(" %s\n", err.Error()) // No need to exit here
7272
}
@@ -76,7 +76,7 @@ func NewWatcher(paths []string, files []string) {
7676
log.Infof("Initializing watcher...\n")
7777
for _, path := range paths {
7878
log.Infof("Directory( %s )\n", path)
79-
err = watcher.Watch(path)
79+
err = watcher.Add(path)
8080
if err != nil {
8181
log.Errorf("Fail to watch directory[ %s ]\n", err)
8282
os.Exit(2)

0 commit comments

Comments
 (0)