Browse code

vendor: update fsnotify v1.4.9

full diff: https://github.com/fsnotify/fsnotify/compare/1485a34d5d5723fea214f5710708e19a831720e4...v1.4.9

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2020/03/12 17:58:09
Showing 6 changed files
... ...
@@ -100,7 +100,7 @@ github.com/philhofer/fwd                            bb6d471dc95d4fe11e432687f8b7
100 100
 github.com/tinylib/msgp                             af6442a0fcf6e2a1b824f70dd0c734f01e817751 # v1.1.0
101 101
 
102 102
 # fsnotify
103
-github.com/fsnotify/fsnotify                        1485a34d5d5723fea214f5710708e19a831720e4 # v1.4.7-11-g1485a34
103
+github.com/fsnotify/fsnotify                        45d7d09e39ef4ac08d493309fa031790c15bfe8a # v1.4.9
104 104
 
105 105
 # awslogs deps
106 106
 github.com/aws/aws-sdk-go                           2590bc875c54c9fda225d8e4e56a9d28d90c6a47 # v1.28.11
... ...
@@ -1,5 +1,5 @@
1 1
 Copyright (c) 2012 The Go Authors. All rights reserved.
2
-Copyright (c) 2012 fsnotify Authors. All rights reserved.
2
+Copyright (c) 2012-2019 fsnotify Authors. All rights reserved.
3 3
 
4 4
 Redistribution and use in source and binary forms, with or without
5 5
 modification, are permitted provided that the following conditions are
... ...
@@ -10,16 +10,16 @@ go get -u golang.org/x/sys/...
10 10
 
11 11
 Cross platform: Windows, Linux, BSD and macOS.
12 12
 
13
-|Adapter   |OS        |Status    |
14
-|----------|----------|----------|
15
-|inotify   |Linux 2.6.27 or later, Android\*|Supported [![Build Status](https://travis-ci.org/fsnotify/fsnotify.svg?branch=master)](https://travis-ci.org/fsnotify/fsnotify)|
16
-|kqueue    |BSD, macOS, iOS\*|Supported [![Build Status](https://travis-ci.org/fsnotify/fsnotify.svg?branch=master)](https://travis-ci.org/fsnotify/fsnotify)|
17
-|ReadDirectoryChangesW|Windows|Supported [![Build Status](https://travis-ci.org/fsnotify/fsnotify.svg?branch=master)](https://travis-ci.org/fsnotify/fsnotify)|
18
-|FSEvents  |macOS         |[Planned](https://github.com/fsnotify/fsnotify/issues/11)|
19
-|FEN       |Solaris 11    |[In Progress](https://github.com/fsnotify/fsnotify/issues/12)|
20
-|fanotify  |Linux 2.6.37+ | |
21
-|USN Journals |Windows    |[Maybe](https://github.com/fsnotify/fsnotify/issues/53)|
22
-|Polling   |*All*         |[Maybe](https://github.com/fsnotify/fsnotify/issues/9)|
13
+| Adapter               | OS                               | Status                                                                                                                          |
14
+| --------------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
15
+| inotify               | Linux 2.6.27 or later, Android\* | Supported [![Build Status](https://travis-ci.org/fsnotify/fsnotify.svg?branch=master)](https://travis-ci.org/fsnotify/fsnotify) |
16
+| kqueue                | BSD, macOS, iOS\*                | Supported [![Build Status](https://travis-ci.org/fsnotify/fsnotify.svg?branch=master)](https://travis-ci.org/fsnotify/fsnotify) |
17
+| ReadDirectoryChangesW | Windows                          | Supported [![Build Status](https://travis-ci.org/fsnotify/fsnotify.svg?branch=master)](https://travis-ci.org/fsnotify/fsnotify) |
18
+| FSEvents              | macOS                            | [Planned](https://github.com/fsnotify/fsnotify/issues/11)                                                                       |
19
+| FEN                   | Solaris 11                       | [In Progress](https://github.com/fsnotify/fsnotify/issues/12)                                                                   |
20
+| fanotify              | Linux 2.6.37+                    | [Planned](https://github.com/fsnotify/fsnotify/issues/114)                                                                      |
21
+| USN Journals          | Windows                          | [Maybe](https://github.com/fsnotify/fsnotify/issues/53)                                                                         |
22
+| Polling               | *All*                            | [Maybe](https://github.com/fsnotify/fsnotify/issues/9)                                                                          |
23 23
 
24 24
 \* Android and iOS are untested.
25 25
 
... ...
@@ -33,6 +33,53 @@ All [releases](https://github.com/fsnotify/fsnotify/releases) are tagged based o
33 33
 
34 34
 Go 1.6 supports dependencies located in the `vendor/` folder. Unless you are creating a library, it is recommended that you copy fsnotify into `vendor/github.com/fsnotify/fsnotify` within your project, and likewise for `golang.org/x/sys`.
35 35
 
36
+## Usage
37
+
38
+```go
39
+package main
40
+
41
+import (
42
+	"log"
43
+
44
+	"github.com/fsnotify/fsnotify"
45
+)
46
+
47
+func main() {
48
+	watcher, err := fsnotify.NewWatcher()
49
+	if err != nil {
50
+		log.Fatal(err)
51
+	}
52
+	defer watcher.Close()
53
+
54
+	done := make(chan bool)
55
+	go func() {
56
+		for {
57
+			select {
58
+			case event, ok := <-watcher.Events:
59
+				if !ok {
60
+					return
61
+				}
62
+				log.Println("event:", event)
63
+				if event.Op&fsnotify.Write == fsnotify.Write {
64
+					log.Println("modified file:", event.Name)
65
+				}
66
+			case err, ok := <-watcher.Errors:
67
+				if !ok {
68
+					return
69
+				}
70
+				log.Println("error:", err)
71
+			}
72
+		}
73
+	}()
74
+
75
+	err = watcher.Add("/tmp/foo")
76
+	if err != nil {
77
+		log.Fatal(err)
78
+	}
79
+	<-done
80
+}
81
+```
82
+
36 83
 ## Contributing
37 84
 
38 85
 Please refer to [CONTRIBUTING][] before opening an issue or pull request.
... ...
@@ -65,6 +112,10 @@ There are OS-specific limits as to how many watches can be created:
65 65
 * Linux: /proc/sys/fs/inotify/max_user_watches contains the limit, reaching this limit results in a "no space left on device" error.
66 66
 * BSD / OSX: sysctl variables "kern.maxfiles" and "kern.maxfilesperproc", reaching these limits results in a "too many open files" error.
67 67
 
68
+**Why don't notifications work with NFS filesystems or filesystem in userspace (FUSE)?**
69
+
70
+fsnotify requires support from underlying OS to work. The current NFS protocol does not provide network level support for file notifications.
71
+
68 72
 [#62]: https://github.com/howeyc/fsnotify/issues/62
69 73
 [#18]: https://github.com/fsnotify/fsnotify/issues/18
70 74
 [#11]: https://github.com/fsnotify/fsnotify/issues/11
71 75
new file mode 100644
... ...
@@ -0,0 +1,5 @@
0
+module github.com/fsnotify/fsnotify
1
+
2
+go 1.13
3
+
4
+require golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9
... ...
@@ -8,4 +8,4 @@ package fsnotify
8 8
 
9 9
 import "golang.org/x/sys/unix"
10 10
 
11
-const openMode = unix.O_NONBLOCK | unix.O_RDONLY
11
+const openMode = unix.O_NONBLOCK | unix.O_RDONLY | unix.O_CLOEXEC
... ...
@@ -9,4 +9,4 @@ package fsnotify
9 9
 import "golang.org/x/sys/unix"
10 10
 
11 11
 // note: this constant is not defined on BSD
12
-const openMode = unix.O_EVTONLY
12
+const openMode = unix.O_EVTONLY | unix.O_CLOEXEC