summaryrefslogtreecommitdiffstats
path: root/vendor/gopkg.in
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-11-16 19:28:52 -0500
committerGitHub <noreply@github.com>2016-11-16 19:28:52 -0500
commit0135904f7d3e1c0e763adaefe267c736616e3d26 (patch)
treec27be7588f98eaea62e0bd0c0087f2b348da9738 /vendor/gopkg.in
parent0b296dd8c2aefefe89787be5cc627d44cf431150 (diff)
downloadchat-0135904f7d3e1c0e763adaefe267c736616e3d26.tar.gz
chat-0135904f7d3e1c0e763adaefe267c736616e3d26.tar.bz2
chat-0135904f7d3e1c0e763adaefe267c736616e3d26.zip
Upgrading server dependancies (#4566)
Diffstat (limited to 'vendor/gopkg.in')
-rw-r--r--vendor/gopkg.in/fsnotify.v1/.editorconfig5
-rw-r--r--vendor/gopkg.in/fsnotify.v1/.github/ISSUE_TEMPLATE.md11
-rw-r--r--vendor/gopkg.in/fsnotify.v1/.github/PULL_REQUEST_TEMPLATE.md8
-rw-r--r--vendor/gopkg.in/fsnotify.v1/.travis.yml3
-rw-r--r--vendor/gopkg.in/fsnotify.v1/AUTHORS2
-rw-r--r--vendor/gopkg.in/fsnotify.v1/CHANGELOG.md14
-rw-r--r--vendor/gopkg.in/fsnotify.v1/CONTRIBUTING.md2
-rw-r--r--vendor/gopkg.in/fsnotify.v1/README.md2
-rw-r--r--vendor/gopkg.in/fsnotify.v1/fsnotify.go26
-rw-r--r--vendor/gopkg.in/fsnotify.v1/fsnotify_test.go40
-rw-r--r--vendor/gopkg.in/fsnotify.v1/inotify.go2
-rw-r--r--vendor/gopkg.in/fsnotify.v1/inotify_test.go128
12 files changed, 168 insertions, 75 deletions
diff --git a/vendor/gopkg.in/fsnotify.v1/.editorconfig b/vendor/gopkg.in/fsnotify.v1/.editorconfig
new file mode 100644
index 000000000..ba49e3c23
--- /dev/null
+++ b/vendor/gopkg.in/fsnotify.v1/.editorconfig
@@ -0,0 +1,5 @@
+root = true
+
+[*]
+indent_style = tab
+indent_size = 4
diff --git a/vendor/gopkg.in/fsnotify.v1/.github/ISSUE_TEMPLATE.md b/vendor/gopkg.in/fsnotify.v1/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 000000000..4ad1aed8f
--- /dev/null
+++ b/vendor/gopkg.in/fsnotify.v1/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,11 @@
+Before reporting an issue, please ensure you are using the latest release of fsnotify.
+
+### Which operating system (GOOS) and version are you using?
+
+Linux: lsb_release -a
+macOS: sw_vers
+Windows: systeminfo | findstr /B /C:OS
+
+### Please describe the issue that occurred.
+
+### Are you able to reproduce the issue? Please provide steps to reproduce and a code sample if possible.
diff --git a/vendor/gopkg.in/fsnotify.v1/.github/PULL_REQUEST_TEMPLATE.md b/vendor/gopkg.in/fsnotify.v1/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 000000000..64ddf7cef
--- /dev/null
+++ b/vendor/gopkg.in/fsnotify.v1/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,8 @@
+#### What does this pull request do?
+
+
+#### Where should the reviewer start?
+
+
+#### How should this be manually tested?
+
diff --git a/vendor/gopkg.in/fsnotify.v1/.travis.yml b/vendor/gopkg.in/fsnotify.v1/.travis.yml
index 00fd5dd30..3a5c933bc 100644
--- a/vendor/gopkg.in/fsnotify.v1/.travis.yml
+++ b/vendor/gopkg.in/fsnotify.v1/.travis.yml
@@ -2,8 +2,7 @@ sudo: false
language: go
go:
- - 1.5.4
- - 1.6.1
+ - 1.6.3
- tip
matrix:
diff --git a/vendor/gopkg.in/fsnotify.v1/AUTHORS b/vendor/gopkg.in/fsnotify.v1/AUTHORS
index 71c47ce89..0a5bf8f61 100644
--- a/vendor/gopkg.in/fsnotify.v1/AUTHORS
+++ b/vendor/gopkg.in/fsnotify.v1/AUTHORS
@@ -26,12 +26,14 @@ Kelvin Fo <vmirage@gmail.com>
Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp>
Matt Layher <mdlayher@gmail.com>
Nathan Youngman <git@nathany.com>
+Patrick <patrick@dropbox.com>
Paul Hammond <paul@paulhammond.org>
Pawel Knap <pawelknap88@gmail.com>
Pieter Droogendijk <pieter@binky.org.uk>
Pursuit92 <JoshChase@techpursuit.net>
Riku Voipio <riku.voipio@linaro.org>
Rob Figueiredo <robfig@gmail.com>
+Slawek Ligus <root@ooz.ie>
Soge Zhang <zhssoge@gmail.com>
Tiffany Jernigan <tiffany.jernigan@intel.com>
Tilak Sharma <tilaks@google.com>
diff --git a/vendor/gopkg.in/fsnotify.v1/CHANGELOG.md b/vendor/gopkg.in/fsnotify.v1/CHANGELOG.md
index f6c7c485c..40d7660d5 100644
--- a/vendor/gopkg.in/fsnotify.v1/CHANGELOG.md
+++ b/vendor/gopkg.in/fsnotify.v1/CHANGELOG.md
@@ -1,8 +1,20 @@
# Changelog
+## v1.4.2 / 2016-10-10
+
+* Linux: use InotifyInit1 with IN_CLOEXEC to stop leaking a file descriptor to a child process when using fork/exec [#178](https://github.com/fsnotify/fsnotify/pull/178) (thanks @pattyshack)
+
+## v1.4.1 / 2016-10-04
+
+* Fix flaky inotify stress test on Linux [#177](https://github.com/fsnotify/fsnotify/pull/177) (thanks @pattyshack)
+
+## v1.4.0 / 2016-10-01
+
+* add a String() method to Event.Op [#165](https://github.com/fsnotify/fsnotify/pull/165) (thanks @oozie)
+
## v1.3.1 / 2016-06-28
-* windows: fix for double backslash when watching the root of a drive [#151](https://github.com/fsnotify/fsnotify/issues/151) (thanks @brunoqc)
+* Windows: fix for double backslash when watching the root of a drive [#151](https://github.com/fsnotify/fsnotify/issues/151) (thanks @brunoqc)
## v1.3.0 / 2016-04-19
diff --git a/vendor/gopkg.in/fsnotify.v1/CONTRIBUTING.md b/vendor/gopkg.in/fsnotify.v1/CONTRIBUTING.md
index 617e45a06..6a81ba489 100644
--- a/vendor/gopkg.in/fsnotify.v1/CONTRIBUTING.md
+++ b/vendor/gopkg.in/fsnotify.v1/CONTRIBUTING.md
@@ -40,7 +40,7 @@ Contribute upstream:
3. Push to the branch (`git push fork my-new-feature`)
4. Create a new Pull Request on GitHub
-This workflow is [thoroughly explained by Katrina Owen](https://blog.splice.com/contributing-open-source-git-repositories-go/).
+This workflow is [thoroughly explained by Katrina Owen](https://splice.com/blog/contributing-open-source-git-repositories-go/).
### Testing
diff --git a/vendor/gopkg.in/fsnotify.v1/README.md b/vendor/gopkg.in/fsnotify.v1/README.md
index 5ebce86eb..3c891e349 100644
--- a/vendor/gopkg.in/fsnotify.v1/README.md
+++ b/vendor/gopkg.in/fsnotify.v1/README.md
@@ -1,6 +1,6 @@
# File system notifications for Go
-[![GoDoc](https://godoc.org/github.com/fsnotify/fsnotify?status.svg)](https://godoc.org/github.com/fsnotify/fsnotify) [![Go Report Card](https://goreportcard.com/badge/github.com/fsnotify/fsnotify)](https://goreportcard.com/report/github.com/fsnotify/fsnotify) [![Coverage](http://gocover.io/_badge/github.com/fsnotify/fsnotify)](http://gocover.io/github.com/fsnotify/fsnotify)
+[![GoDoc](https://godoc.org/github.com/fsnotify/fsnotify?status.svg)](https://godoc.org/github.com/fsnotify/fsnotify) [![Go Report Card](https://goreportcard.com/badge/github.com/fsnotify/fsnotify)](https://goreportcard.com/report/github.com/fsnotify/fsnotify)
fsnotify utilizes [golang.org/x/sys](https://godoc.org/golang.org/x/sys) rather than `syscall` from the standard library. Ensure you have the latest version installed by running:
diff --git a/vendor/gopkg.in/fsnotify.v1/fsnotify.go b/vendor/gopkg.in/fsnotify.v1/fsnotify.go
index d1d39a0eb..e7f55fee7 100644
--- a/vendor/gopkg.in/fsnotify.v1/fsnotify.go
+++ b/vendor/gopkg.in/fsnotify.v1/fsnotify.go
@@ -30,33 +30,33 @@ const (
Chmod
)
-// String returns a string representation of the event in the form
-// "file: REMOVE|WRITE|..."
-func (e Event) String() string {
+func (op Op) String() string {
// Use a buffer for efficient string concatenation
var buffer bytes.Buffer
- if e.Op&Create == Create {
+ if op&Create == Create {
buffer.WriteString("|CREATE")
}
- if e.Op&Remove == Remove {
+ if op&Remove == Remove {
buffer.WriteString("|REMOVE")
}
- if e.Op&Write == Write {
+ if op&Write == Write {
buffer.WriteString("|WRITE")
}
- if e.Op&Rename == Rename {
+ if op&Rename == Rename {
buffer.WriteString("|RENAME")
}
- if e.Op&Chmod == Chmod {
+ if op&Chmod == Chmod {
buffer.WriteString("|CHMOD")
}
-
- // If buffer remains empty, return no event names
if buffer.Len() == 0 {
- return fmt.Sprintf("%q: ", e.Name)
+ return ""
}
+ return buffer.String()[1:] // Strip leading pipe
+}
- // Return a list of event names, with leading pipe character stripped
- return fmt.Sprintf("%q: %s", e.Name, buffer.String()[1:])
+// String returns a string representation of the event in the form
+// "file: REMOVE|WRITE|..."
+func (e Event) String() string {
+ return fmt.Sprintf("%q: %s", e.Name, e.Op.String())
}
diff --git a/vendor/gopkg.in/fsnotify.v1/fsnotify_test.go b/vendor/gopkg.in/fsnotify.v1/fsnotify_test.go
new file mode 100644
index 000000000..9d6d72afc
--- /dev/null
+++ b/vendor/gopkg.in/fsnotify.v1/fsnotify_test.go
@@ -0,0 +1,40 @@
+// Copyright 2016 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build !plan9
+
+package fsnotify
+
+import "testing"
+
+func TestEventStringWithValue(t *testing.T) {
+ for opMask, expectedString := range map[Op]string{
+ Chmod | Create: `"/usr/someFile": CREATE|CHMOD`,
+ Rename: `"/usr/someFile": RENAME`,
+ Remove: `"/usr/someFile": REMOVE`,
+ Write | Chmod: `"/usr/someFile": WRITE|CHMOD`,
+ } {
+ event := Event{Name: "/usr/someFile", Op: opMask}
+ if event.String() != expectedString {
+ t.Fatalf("Expected %s, got: %v", expectedString, event.String())
+ }
+
+ }
+}
+
+func TestEventOpStringWithValue(t *testing.T) {
+ expectedOpString := "WRITE|CHMOD"
+ event := Event{Name: "someFile", Op: Write | Chmod}
+ if event.Op.String() != expectedOpString {
+ t.Fatalf("Expected %s, got: %v", expectedOpString, event.Op.String())
+ }
+}
+
+func TestEventOpStringWithNoValue(t *testing.T) {
+ expectedOpString := ""
+ event := Event{Name: "testFile", Op: 0}
+ if event.Op.String() != expectedOpString {
+ t.Fatalf("Expected %s, got: %v", expectedOpString, event.Op.String())
+ }
+}
diff --git a/vendor/gopkg.in/fsnotify.v1/inotify.go b/vendor/gopkg.in/fsnotify.v1/inotify.go
index 9700df55e..f3b74c51f 100644
--- a/vendor/gopkg.in/fsnotify.v1/inotify.go
+++ b/vendor/gopkg.in/fsnotify.v1/inotify.go
@@ -36,7 +36,7 @@ type Watcher struct {
// NewWatcher establishes a new watcher with the underlying OS and begins waiting for events.
func NewWatcher() (*Watcher, error) {
// Create inotify fd
- fd, errno := unix.InotifyInit()
+ fd, errno := unix.InotifyInit1(unix.IN_CLOEXEC)
if fd == -1 {
return nil, errno
}
diff --git a/vendor/gopkg.in/fsnotify.v1/inotify_test.go b/vendor/gopkg.in/fsnotify.v1/inotify_test.go
index 2527cad1f..a4bb202d1 100644
--- a/vendor/gopkg.in/fsnotify.v1/inotify_test.go
+++ b/vendor/gopkg.in/fsnotify.v1/inotify_test.go
@@ -10,10 +10,9 @@ import (
"fmt"
"os"
"path/filepath"
+ "strings"
"testing"
"time"
-
- "golang.org/x/sys/unix"
)
func TestInotifyCloseRightAway(t *testing.T) {
@@ -154,10 +153,14 @@ func TestInotifyCloseCreate(t *testing.T) {
}
}
+// This test verifies the watcher can keep up with file creations/deletions
+// when under load.
func TestInotifyStress(t *testing.T) {
+ maxNumToCreate := 1000
+
testDir := tempMkdir(t)
defer os.RemoveAll(testDir)
- testFile := filepath.Join(testDir, "testfile")
+ testFilePrefix := filepath.Join(testDir, "testfile")
w, err := NewWatcher()
if err != nil {
@@ -165,84 +168,85 @@ func TestInotifyStress(t *testing.T) {
}
defer w.Close()
- killchan := make(chan struct{})
- defer close(killchan)
-
err = w.Add(testDir)
if err != nil {
t.Fatalf("Failed to add testDir: %v", err)
}
- proc, err := os.FindProcess(os.Getpid())
- if err != nil {
- t.Fatalf("Error finding process: %v", err)
- }
+ doneChan := make(chan struct{})
+ // The buffer ensures that the file generation goroutine is never blocked.
+ errChan := make(chan error, 2*maxNumToCreate)
go func() {
- for {
- select {
- case <-time.After(5 * time.Millisecond):
- err := proc.Signal(unix.SIGUSR1)
- if err != nil {
- t.Fatalf("Signal failed: %v", err)
- }
- case <-killchan:
- return
+ for i := 0; i < maxNumToCreate; i++ {
+ testFile := fmt.Sprintf("%s%d", testFilePrefix, i)
+
+ handle, err := os.Create(testFile)
+ if err != nil {
+ errChan <- fmt.Errorf("Create failed: %v", err)
+ continue
}
- }
- }()
- go func() {
- for {
- select {
- case <-time.After(11 * time.Millisecond):
- err := w.poller.wake()
- if err != nil {
- t.Fatalf("Wake failed: %v", err)
- }
- case <-killchan:
- return
+ err = handle.Close()
+ if err != nil {
+ errChan <- fmt.Errorf("Close failed: %v", err)
+ continue
}
}
- }()
- go func() {
- for {
- select {
- case <-killchan:
- return
- default:
- handle, err := os.Create(testFile)
- if err != nil {
- t.Fatalf("Create failed: %v", err)
- }
- handle.Close()
- time.Sleep(time.Millisecond)
- err = os.Remove(testFile)
- if err != nil {
- t.Fatalf("Remove failed: %v", err)
- }
+ // If we delete a newly created file too quickly, inotify will skip the
+ // create event and only send the delete event.
+ time.Sleep(100 * time.Millisecond)
+
+ for i := 0; i < maxNumToCreate; i++ {
+ testFile := fmt.Sprintf("%s%d", testFilePrefix, i)
+ err = os.Remove(testFile)
+ if err != nil {
+ errChan <- fmt.Errorf("Remove failed: %v", err)
}
}
+
+ close(doneChan)
}()
creates := 0
removes := 0
- after := time.After(5 * time.Second)
- for {
+
+ finished := false
+ after := time.After(10 * time.Second)
+ for !finished {
select {
case <-after:
- if creates-removes > 1 || creates-removes < -1 {
- t.Fatalf("Creates and removes should not be off by more than one: %d creates, %d removes", creates, removes)
+ t.Fatalf("Not done")
+ case <-doneChan:
+ finished = true
+ case err := <-errChan:
+ t.Fatalf("Got an error from file creator goroutine: %v", err)
+ case err := <-w.Errors:
+ t.Fatalf("Got an error from watcher: %v", err)
+ case evt := <-w.Events:
+ if !strings.HasPrefix(evt.Name, testFilePrefix) {
+ t.Fatalf("Got an event for an unknown file: %s", evt.Name)
+ }
+ if evt.Op == Create {
+ creates++
}
- if creates < 50 {
- t.Fatalf("Expected at least 50 creates, got %d", creates)
+ if evt.Op == Remove {
+ removes++
}
- return
+ }
+ }
+
+ // Drain remaining events from channels
+ count := 0
+ for count < 10 {
+ select {
+ case err := <-errChan:
+ t.Fatalf("Got an error from file creator goroutine: %v", err)
case err := <-w.Errors:
t.Fatalf("Got an error from watcher: %v", err)
case evt := <-w.Events:
- if evt.Name != testFile {
+ if !strings.HasPrefix(evt.Name, testFilePrefix) {
t.Fatalf("Got an event for an unknown file: %s", evt.Name)
}
if evt.Op == Create {
@@ -251,8 +255,20 @@ func TestInotifyStress(t *testing.T) {
if evt.Op == Remove {
removes++
}
+ count = 0
+ default:
+ count++
+ // Give the watcher chances to fill the channels.
+ time.Sleep(time.Millisecond)
}
}
+
+ if creates-removes > 1 || creates-removes < -1 {
+ t.Fatalf("Creates and removes should not be off by more than one: %d creates, %d removes", creates, removes)
+ }
+ if creates < 50 {
+ t.Fatalf("Expected at least 50 creates, got %d", creates)
+ }
}
func TestInotifyRemoveTwice(t *testing.T) {