Skip to content

Commit

Permalink
add create and remove actions to watch filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Vlasic committed Aug 16, 2021
1 parent 8674e8c commit 7005f49
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/mantil/cmd/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var watchCmd = &cobra.Command{
}
watch.Start(path, func() {
log.Println("changes detected - starting deploy")
defer log.Println("deploy successfully finished")
defer log.Println("deploy finished")
if err := d.Deploy(); err != nil {
log.Fatal(err)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/commands/watch/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func Start(path string, onChange func()) {
w := watcher.New()

w.SetMaxEvents(1)
w.FilterOps(watcher.Write)
w.FilterOps(watcher.Write, watcher.Create, watcher.Remove)

// only watch for changes in go files
r := regexp.MustCompile(`\.go$`)
Expand All @@ -35,7 +35,7 @@ func Start(path string, onChange func()) {
log.Fatal(err)
}

log.Printf("starting watch for all go files in %s", path)
log.Printf("starting watch on go files in %s", path)
if err := w.Start(1 * time.Second); err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit 7005f49

Please sign in to comment.