]> go.fuhry.dev Git - fsnotify.git/commitdiff
Don't build on appengine
authorMartin Tournoij <martin@arp242.net>
Fri, 4 Nov 2022 21:54:40 +0000 (22:54 +0100)
committerMartin Tournoij <martin@arp242.net>
Fri, 4 Nov 2022 21:54:40 +0000 (22:54 +0100)
AppEngine forbids usage of the unsafe package,

Fixes #534
Fixes https://github.com/spf13/viper/issues/538

backend_inotify.go
backend_other.go

index 16ac36e127edabf12fe3119072d5e7cf8e9f8f56..e0f9f28c8868052c9ed93bfd95663fe7abdc00f5 100644 (file)
@@ -1,5 +1,5 @@
-//go:build linux
-// +build linux
+//go:build linux && !appengine
+// +build linux,!appengine
 
 package fsnotify
 
index 60d57053e534dbaa68e4e3a6fc7325f7e17e811b..b62717072d64b38d7bcb6e92ef7247d6b234efb3 100644 (file)
@@ -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.
 //