Remove pointer from fsnotify.Event
This commit is contained in:
parent
8b4773e24e
commit
abb1479f04
|
@ -77,7 +77,7 @@ func (fw *InotifyFileWatcher) ChangeEvents(t *tomb.Tomb, fi os.FileInfo) *FileCh
|
|||
for {
|
||||
prevSize := fw.Size
|
||||
|
||||
var evt *fsnotify.Event
|
||||
var evt fsnotify.Event
|
||||
var ok bool
|
||||
|
||||
select {
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
type InotifyTracker struct {
|
||||
mux sync.Mutex
|
||||
watcher *fsnotify.Watcher
|
||||
chans map[string]chan *fsnotify.Event
|
||||
chans map[string]chan fsnotify.Event
|
||||
done map[string]chan bool
|
||||
watch chan *watchInfo
|
||||
remove chan string
|
||||
|
@ -36,7 +36,7 @@ var (
|
|||
goRun = func() {
|
||||
shared = &InotifyTracker{
|
||||
mux: sync.Mutex{},
|
||||
chans: make(map[string]chan *fsnotify.Event),
|
||||
chans: make(map[string]chan fsnotify.Event),
|
||||
done: make(map[string]chan bool),
|
||||
watch: make(chan *watchInfo),
|
||||
remove: make(chan string),
|
||||
|
@ -78,7 +78,7 @@ func RemoveWatch(fname string) {
|
|||
// Events returns a channel to which FileEvents corresponding to the input filename
|
||||
// will be sent. This channel will be closed when removeWatch is called on this
|
||||
// filename.
|
||||
func Events(fname string) chan *fsnotify.Event {
|
||||
func Events(fname string) chan fsnotify.Event {
|
||||
shared.mux.Lock()
|
||||
defer shared.mux.Unlock()
|
||||
|
||||
|
@ -97,7 +97,7 @@ func (shared *InotifyTracker) addWatch(fname string) error {
|
|||
defer shared.mux.Unlock()
|
||||
|
||||
if shared.chans[fname] == nil {
|
||||
shared.chans[fname] = make(chan *fsnotify.Event)
|
||||
shared.chans[fname] = make(chan fsnotify.Event)
|
||||
shared.done[fname] = make(chan bool)
|
||||
}
|
||||
return shared.watcher.Add(fname)
|
||||
|
@ -118,7 +118,7 @@ func (shared *InotifyTracker) removeWatch(fname string) {
|
|||
}
|
||||
|
||||
// sendEvent sends the input event to the appropriate Tail.
|
||||
func (shared *InotifyTracker) sendEvent(event *fsnotify.Event) {
|
||||
func (shared *InotifyTracker) sendEvent(event fsnotify.Event) {
|
||||
shared.mux.Lock()
|
||||
ch := shared.chans[event.Name]
|
||||
done := shared.done[event.Name]
|
||||
|
@ -153,7 +153,7 @@ func (shared *InotifyTracker) run() {
|
|||
if !open {
|
||||
return
|
||||
}
|
||||
shared.sendEvent(&event)
|
||||
shared.sendEvent(event)
|
||||
|
||||
case err, open := <-shared.watcher.Errors:
|
||||
if !open {
|
||||
|
|
Loading…
Reference in New Issue