Skip to content

Commit 97dc3a7

Browse files
committed
a fork to experiment on
1 parent 441bbc8 commit 97dc3a7

File tree

3 files changed

+3
-82
lines changed

3 files changed

+3
-82
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
# git config --global core.excludesfile ~/.gitignore_global
44

55
.vagrant
6+
*.sublime-project

README.md

+1-81
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# File system notifications for Go
22

3-
[![Build Status](https://goci.herokuapp.com/project/image/github.com/howeyc/fsnotify)](http://goci.me/project/github.com/howeyc/fsnotify) [![GoDoc](https://godoc.org/github.com/howeyc/fsnotify?status.png)](http://godoc.org/github.com/howeyc/fsnotify)
3+
[![Build Status](https://drone.io/github.com/gophertown/fsnotify/status.png)](https://drone.io/github.com/gophertown/fsnotify/latest) [![Coverage](http://gocover.io/_badge/github.com/gophertown/fsnotify)](http://gocover.io/github.com/gophertown/fsnotify) [![GoDoc](https://godoc.org/github.com/gophertown/fsnotify?status.png)](http://godoc.org/github.com/gophertown/fsnotify)
44

55
Cross platform, works on:
66
* Windows
@@ -18,84 +18,4 @@ We plan to include os/fsnotify in the Go standard library with a new [API](http:
1818
* Join [golang-dev](https://groups.google.com/forum/#!forum/golang-dev) to discuss fsnotify.
1919
* See the [Contribution Guidelines](http://golang.org/doc/contribute.html) for Go and sign the CLA.
2020

21-
### Example:
22-
23-
```go
24-
package main
25-
26-
import (
27-
"log"
28-
29-
"github.com/howeyc/fsnotify"
30-
)
31-
32-
func main() {
33-
watcher, err := fsnotify.NewWatcher()
34-
if err != nil {
35-
log.Fatal(err)
36-
}
37-
38-
done := make(chan bool)
39-
40-
// Process events
41-
go func() {
42-
for {
43-
select {
44-
case ev := <-watcher.Event:
45-
log.Println("event:", ev)
46-
case err := <-watcher.Error:
47-
log.Println("error:", err)
48-
}
49-
}
50-
}()
51-
52-
err = watcher.Watch("testDir")
53-
if err != nil {
54-
log.Fatal(err)
55-
}
56-
57-
<-done
58-
59-
/* ... do stuff ... */
60-
watcher.Close()
61-
}
62-
```
63-
64-
For each event:
65-
* Name
66-
* IsCreate()
67-
* IsDelete()
68-
* IsModify()
69-
* IsRename()
70-
71-
### FAQ
72-
73-
**When a file is moved to another directory is it still being watched?**
74-
75-
No (it shouldn't be, unless you are watching where it was moved to).
76-
77-
**When I watch a directory, are all subdirectories watched as well?**
78-
79-
No, you must add watches for any directory you want to watch (a recursive watcher is in the works [#56][]).
80-
81-
**Do I have to watch the Error and Event channels in a separate goroutine?**
82-
83-
As of now, yes. Looking into making this single-thread friendly (see [#7][])
84-
85-
**Why am I receiving multiple events for the same file on OS X?**
86-
87-
Spotlight indexing on OS X can result in multiple events (see [#62][]). A temporary workaround is to add your folder(s) to the *Spotlight Privacy settings* until we have a native FSEvents implementation (see [#54][]).
88-
89-
**How many files can be watched at once?**
90-
91-
There are OS-specific limits as to how many watches can be created:
92-
* Linux: /proc/sys/fs/inotify/max_user_watches contains the limit,
93-
reaching this limit results in a "no space left on device" error.
94-
* BSD / OSX: sysctl variables "kern.maxfiles" and "kern.maxfilesperproc", reaching these limits results in a "too many open files" error.
95-
96-
97-
[#62]: https://github.com/howeyc/fsnotify/issues/62
98-
[#56]: https://github.com/howeyc/fsnotify/issues/56
99-
[#54]: https://github.com/howeyc/fsnotify/issues/54
100-
[#7]: https://github.com/howeyc/fsnotify/issues/7
10121

example_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ package fsnotify_test
77
import (
88
"log"
99

10-
"github.com/howeyc/fsnotify"
10+
"github.com/gophertown/fsnotify"
1111
)
1212

1313
func ExampleNewWatcher() {

0 commit comments

Comments
 (0)