From: Martin Tournoij Date: Fri, 4 Nov 2022 21:54:40 +0000 (+0100) Subject: Don't build on appengine X-Git-Tag: v1.7.2~26 X-Git-Url: https://go.fuhry.dev/?a=commitdiff_plain;h=7ed195facfcd33fc8a54c731565fbbe1f959edd6;p=fsnotify.git Don't build on appengine AppEngine forbids usage of the unsafe package, Fixes #534 Fixes https://github.com/spf13/viper/issues/538 --- diff --git a/backend_inotify.go b/backend_inotify.go index 16ac36e..e0f9f28 100644 --- a/backend_inotify.go +++ b/backend_inotify.go @@ -1,5 +1,5 @@ -//go:build linux -// +build linux +//go:build linux && !appengine +// +build linux,!appengine package fsnotify diff --git a/backend_other.go b/backend_other.go index 60d5705..b627170 100644 --- a/backend_other.go +++ b/backend_other.go @@ -1,12 +1,9 @@ -//go:build !darwin && !dragonfly && !freebsd && !openbsd && !linux && !netbsd && !solaris && !windows -// +build !darwin,!dragonfly,!freebsd,!openbsd,!linux,!netbsd,!solaris,!windows +//go:build appengine || (!darwin && !dragonfly && !freebsd && !openbsd && !linux && !netbsd && !solaris && !windows) +// +build appengine !darwin,!dragonfly,!freebsd,!openbsd,!linux,!netbsd,!solaris,!windows package fsnotify -import ( - "fmt" - "runtime" -) +import "errors" // Watcher watches a set of paths, delivering events on a channel. // @@ -107,7 +104,7 @@ type Watcher struct { // NewWatcher creates a new Watcher. func NewWatcher() (*Watcher, error) { - return nil, fmt.Errorf("fsnotify not supported on %s", runtime.GOOS) + return nil, errors.New("fsnotify not supported on the current platform") } // Close removes all watches and closes the events channel. @@ -161,9 +158,7 @@ func (w *Watcher) Add(name string) error { return nil } // // - [WithBufferSize] sets the buffer size for the Windows backend; no-op on // other platforms. The default is 64K (65536 bytes). -func (w *Watcher) AddWith(name string, opts ...addOpt) error { - return nil -} +func (w *Watcher) AddWith(name string, opts ...addOpt) error { return nil } // Remove stops monitoring the path for changes. //