From 2b285b5e6230d31b51bacc231764a954581334bf Mon Sep 17 00:00:00 2001 From: Tony Huang Date: Sun, 10 Dec 2017 12:55:13 +0800 Subject: [PATCH 1/2] fix tool args bug --- realize/tools.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/realize/tools.go b/realize/tools.go index 89b974e..0b37f1a 100644 --- a/realize/tools.go +++ b/realize/tools.go @@ -98,9 +98,9 @@ func (t *Tool) Exec(path string, stop <-chan bool) (response Response) { } else if !strings.HasSuffix(path, ".go") { return } - args := []string{} + args := t.Args if strings.HasSuffix(path, ".go") { - args = append(t.Args, path) + args = append(args, path) path = filepath.Dir(path) } if s := ext(path); s == "" || s == "go" { From 406658de13004ab9bbe7bdc850e4d191e838975b Mon Sep 17 00:00:00 2001 From: Morten Slaatten Berg Date: Thu, 21 Dec 2017 10:55:37 +0100 Subject: [PATCH 2/2] Trigger reload if event time is equal to or later than file modified time This covers the case when editing the same file several times, as event time and file modified time often has the same value when this code is reached. --- realize/projects.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/realize/projects.go b/realize/projects.go index 3613764..984b32c 100644 --- a/realize/projects.go +++ b/realize/projects.go @@ -308,7 +308,7 @@ L: if fi.IsDir() { filepath.Walk(event.Name, p.walk) } else { - if event.Op != fsnotify.Write || (eventTime.Truncate(time.Millisecond).After(fi.ModTime().Truncate(time.Millisecond)) || event.Name != p.lastFile) { + if event.Op != fsnotify.Write || (!eventTime.Truncate(time.Millisecond).Before(fi.ModTime().Truncate(time.Millisecond)) || event.Name != p.lastFile) { // stop and restart close(p.stop) p.stop = make(chan bool)