Add timestamp and status to Event type

This commit is contained in:
2013-02-13 07:31:10 -05:00
parent 5d3cd40195
commit 6975ef035c
2 changed files with 26 additions and 3 deletions

View File

@ -4,6 +4,7 @@ import (
"github.com/howeyc/fsnotify"
"os"
"path/filepath"
"time"
)
func StartWatching(watchDir string, fileUpdates chan *Event) {
@ -45,7 +46,10 @@ func StartWatching(watchDir string, fileUpdates chan *Event) {
panic("Unknown fsnotify event type")
}
event.Status = NOTICED
event.Path = ev.Name
event.Timestamp = time.Now()
if event.IsUpdate() {
event.Hash, err = HashFile(ev.Name)
if err != nil {