From 57eb1710e9b5f412ae03613c9643d174e8da7a12 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Sun, 10 Dec 2017 19:40:16 +0100 Subject: [PATCH] vendor: Update github.com/zillode/notify --- vendor/github.com/zillode/notify/debug.go | 50 +++++++++++++++++-- .../github.com/zillode/notify/debug_debug.go | 36 +------------ .../zillode/notify/debug_nodebug.go | 9 ++++ vendor/github.com/zillode/notify/node.go | 7 ++- .../zillode/notify/watcher_fsevents_cgo.go | 6 +-- .../zillode/notify/watcher_fsevents_go1.10.go | 9 ++++ .../zillode/notify/watcher_fsevents_go1.9.go | 14 ++++++ vendor/manifest | 2 +- 8 files changed, 88 insertions(+), 45 deletions(-) create mode 100644 vendor/github.com/zillode/notify/debug_nodebug.go create mode 100644 vendor/github.com/zillode/notify/watcher_fsevents_go1.10.go create mode 100644 vendor/github.com/zillode/notify/watcher_fsevents_go1.9.go diff --git a/vendor/github.com/zillode/notify/debug.go b/vendor/github.com/zillode/notify/debug.go index bd9bc468d..2a3eb3370 100644 --- a/vendor/github.com/zillode/notify/debug.go +++ b/vendor/github.com/zillode/notify/debug.go @@ -2,10 +2,52 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -// +build !debug - package notify -func dbgprint(...interface{}) {} +import ( + "log" + "os" + "runtime" + "strings" +) -func dbgprintf(string, ...interface{}) {} +var dbgprint func(...interface{}) + +var dbgprintf func(string, ...interface{}) + +var dbgcallstack func(max int) []string + +func init() { + if _, ok := os.LookupEnv("NOTIFY_DEBUG"); ok || debugTag { + log.SetOutput(os.Stdout) + log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds) + dbgprint = func(v ...interface{}) { + v = append([]interface{}{"[D] "}, v...) + log.Println(v...) + } + dbgprintf = func(format string, v ...interface{}) { + format = "[D] " + format + log.Printf(format, v...) + } + dbgcallstack = func(max int) []string { + pc, stack := make([]uintptr, max), make([]string, 0, max) + runtime.Callers(2, pc) + for _, pc := range pc { + if f := runtime.FuncForPC(pc); f != nil { + fname := f.Name() + idx := strings.LastIndex(fname, string(os.PathSeparator)) + if idx != -1 { + stack = append(stack, fname[idx+1:]) + } else { + stack = append(stack, fname) + } + } + } + return stack + } + return + } + dbgprint = func(v ...interface{}) {} + dbgprintf = func(format string, v ...interface{}) {} + dbgcallstack = func(max int) []string { return nil } +} diff --git a/vendor/github.com/zillode/notify/debug_debug.go b/vendor/github.com/zillode/notify/debug_debug.go index f0622917f..6fca891ab 100644 --- a/vendor/github.com/zillode/notify/debug_debug.go +++ b/vendor/github.com/zillode/notify/debug_debug.go @@ -6,38 +6,4 @@ package notify -import ( - "fmt" - "os" - "runtime" - "strings" -) - -func dbgprint(v ...interface{}) { - fmt.Printf("[D] ") - fmt.Print(v...) - fmt.Printf("\n\n") -} - -func dbgprintf(format string, v ...interface{}) { - fmt.Printf("[D] ") - fmt.Printf(format, v...) - fmt.Printf("\n\n") -} - -func dbgcallstack(max int) []string { - pc, stack := make([]uintptr, max), make([]string, 0, max) - runtime.Callers(2, pc) - for _, pc := range pc { - if f := runtime.FuncForPC(pc); f != nil { - fname := f.Name() - idx := strings.LastIndex(fname, string(os.PathSeparator)) - if idx != -1 { - stack = append(stack, fname[idx+1:]) - } else { - stack = append(stack, fname) - } - } - } - return stack -} +var debugTag bool = true diff --git a/vendor/github.com/zillode/notify/debug_nodebug.go b/vendor/github.com/zillode/notify/debug_nodebug.go new file mode 100644 index 000000000..be391a276 --- /dev/null +++ b/vendor/github.com/zillode/notify/debug_nodebug.go @@ -0,0 +1,9 @@ +// Copyright (c) 2014-2015 The Notify Authors. All rights reserved. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +// +build !debug + +package notify + +var debugTag bool = false diff --git a/vendor/github.com/zillode/notify/node.go b/vendor/github.com/zillode/notify/node.go index 29c1bb20a..aced8b9c4 100644 --- a/vendor/github.com/zillode/notify/node.go +++ b/vendor/github.com/zillode/notify/node.go @@ -6,7 +6,6 @@ package notify import ( "errors" - "fmt" "io/ioutil" "os" "path/filepath" @@ -71,7 +70,11 @@ Traverse: case errSkip: continue Traverse default: - return fmt.Errorf("error while traversing %q: %v", nd.Name, err) + return &os.PathError{ + Op: "error while traversing", + Path: nd.Name, + Err: err, + } } // TODO(rjeczalik): tolerate open failures - add failed names to // AddDirError and notify users which names are not added to the tree. diff --git a/vendor/github.com/zillode/notify/watcher_fsevents_cgo.go b/vendor/github.com/zillode/notify/watcher_fsevents_cgo.go index 5be64632e..fb70de6af 100644 --- a/vendor/github.com/zillode/notify/watcher_fsevents_cgo.go +++ b/vendor/github.com/zillode/notify/watcher_fsevents_cgo.go @@ -48,7 +48,7 @@ var wg sync.WaitGroup // used to wait until the runloop starts // started and is ready via the wg. It also serves purpose of a dummy source, // thanks to it the runloop does not return as it also has at least one source // registered. -var source = C.CFRunLoopSourceCreate(nil, 0, &C.CFRunLoopSourceContext{ +var source = C.CFRunLoopSourceCreate(refZero, 0, &C.CFRunLoopSourceContext{ perform: (C.CFRunLoopPerformCallBack)(C.gosource), }) @@ -159,8 +159,8 @@ func (s *stream) Start() error { return nil } wg.Wait() - p := C.CFStringCreateWithCStringNoCopy(nil, C.CString(s.path), C.kCFStringEncodingUTF8, nil) - path := C.CFArrayCreate(nil, (*unsafe.Pointer)(unsafe.Pointer(&p)), 1, nil) + p := C.CFStringCreateWithCStringNoCopy(refZero, C.CString(s.path), C.kCFStringEncodingUTF8, refZero) + path := C.CFArrayCreate(refZero, (*unsafe.Pointer)(unsafe.Pointer(&p)), 1, nil) ctx := C.FSEventStreamContext{} ref := C.EventStreamCreate(&ctx, C.uintptr_t(s.info), path, C.FSEventStreamEventId(atomic.LoadUint64(&since)), latency, flags) if ref == nilstream { diff --git a/vendor/github.com/zillode/notify/watcher_fsevents_go1.10.go b/vendor/github.com/zillode/notify/watcher_fsevents_go1.10.go new file mode 100644 index 000000000..0edd3782f --- /dev/null +++ b/vendor/github.com/zillode/notify/watcher_fsevents_go1.10.go @@ -0,0 +1,9 @@ +// Copyright (c) 2017 The Notify Authors. All rights reserved. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +// +build darwin,!kqueue,go1.10 + +package notify + +const refZero = 0 diff --git a/vendor/github.com/zillode/notify/watcher_fsevents_go1.9.go b/vendor/github.com/zillode/notify/watcher_fsevents_go1.9.go new file mode 100644 index 000000000..b81c3c185 --- /dev/null +++ b/vendor/github.com/zillode/notify/watcher_fsevents_go1.9.go @@ -0,0 +1,14 @@ +// Copyright (c) 2017 The Notify Authors. All rights reserved. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +// +build darwin,!kqueue,cgo,!go1.10 + +package notify + +/* +#include +*/ +import "C" + +var refZero = (*C.struct___CFAllocator)(nil) diff --git a/vendor/manifest b/vendor/manifest index 53774d1b6..3be36ef56 100644 --- a/vendor/manifest +++ b/vendor/manifest @@ -449,7 +449,7 @@ "importpath": "github.com/zillode/notify", "repository": "https://github.com/zillode/notify", "vcs": "git", - "revision": "54e3093eb7377fd139c4605f475cc78e83610b9d", + "revision": "8fff849a2026ce7a59f67ed9747dd9c7adc8bd0b", "branch": "master", "notests": true },