Skip to content

Commit

Permalink
Merge pull request #44 from JJatSTASH/master
Browse files Browse the repository at this point in the history
Updated to use the new fsnotify
  • Loading branch information
silenceper authored Jan 25, 2022
2 parents c5a3351 + c1a2a24 commit 1a10336
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/silenceper/gowatch
go 1.14

require (
github.com/howeyc/fsnotify v0.9.0
github.com/fsnotify/fsnotify v1.5.1
github.com/mitchellh/go-ps v1.0.0
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/silenceper/log v0.0.0-20171204144354-e5ac7fa8a76a
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/howeyc/fsnotify v0.9.0 h1:0gtV5JmOKH4A8SsFxG2BczSeXWWPvcMT0euZt5gDAxY=
github.com/howeyc/fsnotify v0.9.0/go.mod h1:41HzSPxBGeFRQKEEwgh49TRw/nKBsYZ2cF1OzPjSJsA=
github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
Expand All @@ -9,6 +9,8 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWb
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/silenceper/log v0.0.0-20171204144354-e5ac7fa8a76a h1:COf2KvPmardI1M8p2fhHsXlFS2EXSQygbGgcDYBI9Wc=
github.com/silenceper/log v0.0.0-20171204144354-e5ac7fa8a76a/go.mod h1:nyN/YUSK3CgJjtNzm6dVTkcou+RYXNMP+XLSlzQu0m0=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0 h1:POO/ycCATvegFmVuPpQzZFJ+pGZeX22Ufu6fibxDVjU=
Expand Down
8 changes: 4 additions & 4 deletions gowatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"strings"
"time"

"github.com/howeyc/fsnotify"
"github.com/fsnotify/fsnotify"
"github.com/mitchellh/go-ps"
"github.com/silenceper/log"
)
Expand All @@ -33,7 +33,7 @@ func NewWatcher(paths []string, files []string) {
go func() {
for {
select {
case e := <-watcher.Event:
case e := <-watcher.Events:
isbuild := true

// Skip ignored files
Expand Down Expand Up @@ -66,7 +66,7 @@ func NewWatcher(paths []string, files []string) {
Autobuild(files)
}()
}
case err := <-watcher.Error:
case err := <-watcher.Errors:
log.Errorf("%v", err)
log.Warnf(" %s\n", err.Error()) // No need to exit here
}
Expand All @@ -76,7 +76,7 @@ func NewWatcher(paths []string, files []string) {
log.Infof("Initializing watcher...\n")
for _, path := range paths {
log.Infof("Directory( %s )\n", path)
err = watcher.Watch(path)
err = watcher.Add(path)
if err != nil {
log.Errorf("Fail to watch directory[ %s ]\n", err)
os.Exit(2)
Expand Down

0 comments on commit 1a10336

Please sign in to comment.