Skip to content

Commit e8fe4a0

Browse files
committed
golint fixes
1 parent 1d8f9ae commit e8fe4a0

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

samefile.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ package watcher
44

55
import "os"
66

7-
func SameFile(fi1, fi2 os.FileInfo) bool {
7+
func sameFile(fi1, fi2 os.FileInfo) bool {
88
return os.SameFile(fi1, fi2)
99
}

samefile_windows.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ package watcher
44

55
import "os"
66

7-
func SameFile(fi1, fi2 os.FileInfo) bool {
7+
func sameFile(fi1, fi2 os.FileInfo) bool {
88
return fi1.ModTime() == fi2.ModTime() &&
99
fi1.Size() == fi2.Size() &&
1010
fi1.Mode() == fi2.Mode() &&

watcher.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ func (e Event) String() string {
7979
return "???"
8080
}
8181

82+
// Watcher describes a process that watches files for changes.
8283
type Watcher struct {
8384
Event chan Event
8485
Error chan error
@@ -211,7 +212,7 @@ func (w *Watcher) list(name string) (map[string]os.FileInfo, error) {
211212
return fileList, nil
212213
}
213214

214-
// Add adds either a single file or directory recursively to the file list.
215+
// AddRecursive adds either a single file or directory recursively to the file list.
215216
func (w *Watcher) AddRecursive(name string) (err error) {
216217
w.mu.Lock()
217218
defer w.mu.Unlock()
@@ -292,7 +293,7 @@ func (w *Watcher) Remove(name string) (err error) {
292293
return nil
293294
}
294295

295-
// Remove removes either a single file or a directory recursively from
296+
// RemoveRecursive removes either a single file or a directory recursively from
296297
// the file's list.
297298
func (w *Watcher) RemoveRecursive(name string) (err error) {
298299
w.mu.Lock()
@@ -346,6 +347,7 @@ func (w *Watcher) Ignore(paths ...string) (err error) {
346347
return nil
347348
}
348349

350+
// WatchedFiles retruns a map of files added to a Watcher.
349351
func (w *Watcher) WatchedFiles() map[string]os.FileInfo {
350352
w.mu.Lock()
351353
defer w.mu.Unlock()
@@ -560,7 +562,7 @@ func (w *Watcher) pollEvents(files map[string]os.FileInfo, evt chan Event,
560562
// Check for renames and moves.
561563
for path1, info1 := range removes {
562564
for path2, info2 := range creates {
563-
if SameFile(info1, info2) {
565+
if sameFile(info1, info2) {
564566
e := Event{
565567
Op: Move,
566568
Path: fmt.Sprintf("%s -> %s", path1, path2),
@@ -606,6 +608,7 @@ func (w *Watcher) Wait() {
606608
w.wg.Wait()
607609
}
608610

611+
// Close stops a Watcher and unlocks its mutex, then sends a close signal.
609612
func (w *Watcher) Close() {
610613
w.mu.Lock()
611614
if !w.running {

0 commit comments

Comments
 (0)