go mod vendor

This commit is contained in:
Andrey Nering
2018-11-04 21:37:53 -02:00
parent a701ea3007
commit 5327d702f8
10 changed files with 39 additions and 257 deletions

View File

@@ -4,6 +4,6 @@ package watcher
import "os"
func sameFile(fi1, fi2 os.FileInfo) bool {
func SameFile(fi1, fi2 os.FileInfo) bool {
return os.SameFile(fi1, fi2)
}

View File

@@ -4,7 +4,7 @@ package watcher
import "os"
func sameFile(fi1, fi2 os.FileInfo) bool {
func SameFile(fi1, fi2 os.FileInfo) bool {
return fi1.ModTime() == fi2.ModTime() &&
fi1.Size() == fi2.Size() &&
fi1.Mode() == fi2.Mode() &&

View File

@@ -79,7 +79,6 @@ func (e Event) String() string {
return "???"
}
// Watcher describes a process that watches files for changes.
type Watcher struct {
Event chan Event
Error chan error
@@ -212,7 +211,7 @@ func (w *Watcher) list(name string) (map[string]os.FileInfo, error) {
return fileList, nil
}
// AddRecursive adds either a single file or directory recursively to the file list.
// Add adds either a single file or directory recursively to the file list.
func (w *Watcher) AddRecursive(name string) (err error) {
w.mu.Lock()
defer w.mu.Unlock()
@@ -293,7 +292,7 @@ func (w *Watcher) Remove(name string) (err error) {
return nil
}
// RemoveRecursive removes either a single file or a directory recursively from
// Remove removes either a single file or a directory recursively from
// the file's list.
func (w *Watcher) RemoveRecursive(name string) (err error) {
w.mu.Lock()
@@ -347,7 +346,6 @@ func (w *Watcher) Ignore(paths ...string) (err error) {
return nil
}
// WatchedFiles returns a map of files added to a Watcher.
func (w *Watcher) WatchedFiles() map[string]os.FileInfo {
w.mu.Lock()
defer w.mu.Unlock()
@@ -562,7 +560,7 @@ func (w *Watcher) pollEvents(files map[string]os.FileInfo, evt chan Event,
// Check for renames and moves.
for path1, info1 := range removes {
for path2, info2 := range creates {
if sameFile(info1, info2) {
if SameFile(info1, info2) {
e := Event{
Op: Move,
Path: fmt.Sprintf("%s -> %s", path1, path2),
@@ -608,7 +606,6 @@ func (w *Watcher) Wait() {
w.wg.Wait()
}
// Close stops a Watcher and unlocks its mutex, then sends a close signal.
func (w *Watcher) Close() {
w.mu.Lock()
if !w.running {