vendor: update github.com/rjeczalik/notify for go1.10 (#15785)

This commit is contained in:
Péter Szilágyi
2018-01-02 12:41:47 +02:00
committed by Felix Lange
parent 3e0113fff4
commit d2533d0efb
20 changed files with 229 additions and 158 deletions

View File

@ -23,6 +23,7 @@
package notify
import (
"fmt"
"os"
"path/filepath"
"strings"
@ -56,6 +57,19 @@ type trigger interface {
IsStop(n interface{}, err error) bool
}
// trgWatched is a the base data structure representing watched file/directory.
// The platform specific full data structure (watched) must embed this type.
type trgWatched struct {
// p is a path to watched file/directory.
p string
// fi provides information about watched file/dir.
fi os.FileInfo
// eDir represents events watched directly.
eDir Event
// eNonDir represents events watched indirectly.
eNonDir Event
}
// encode Event to native representation. Implementation is to be provided by
// platform specific implementation.
var encode func(Event, bool) int64
@ -117,6 +131,9 @@ func (t *trg) Close() (err error) {
dbgprintf("trg: closing native watch failed: %q\n", e)
err = nonil(err, e)
}
if remaining := len(t.pthLkp); remaining != 0 {
err = nonil(err, fmt.Errorf("Not all watches were removed: len(t.pthLkp) == %v", len(t.pthLkp)))
}
t.Unlock()
return
}
@ -175,7 +192,7 @@ func decode(o int64, w Event) (e Event) {
func (t *trg) watch(p string, e Event, fi os.FileInfo) error {
if err := t.singlewatch(p, e, dir, fi); err != nil {
if err != errAlreadyWatched {
return nil
return err
}
}
if fi.IsDir() {
@ -361,7 +378,7 @@ func (t *trg) singleunwatch(p string, direct mode) error {
}
if w.eNonDir|w.eDir != 0 {
mod := dir
if w.eNonDir == 0 {
if w.eNonDir != 0 {
mod = ndir
}
if err := t.singlewatch(p, w.eNonDir|w.eDir, mod,