mirror of
https://github.com/spf13/viper
synced 2024-12-22 19:47:01 +00:00
feat: fix compilation for all platforms unsupported by fsnotify
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
parent
2e04739b68
commit
dcb7f30f39
2 changed files with 10 additions and 9 deletions
4
watch.go
4
watch.go
|
@ -1,5 +1,5 @@
|
||||||
//go:build !js && !aix
|
//go:build darwin || dragonfly || freebsd || openbsd || linux || netbsd || solaris || windows
|
||||||
// +build !js,!aix
|
// +build darwin dragonfly freebsd openbsd linux netbsd solaris windows
|
||||||
|
|
||||||
package viper
|
package viper
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,19 @@
|
||||||
//go:build js || aix
|
//go:build !darwin && !dragonfly && !freebsd && !openbsd && !linux && !netbsd && !solaris && !windows
|
||||||
// +build js aix
|
// +build !darwin,!dragonfly,!freebsd,!openbsd,!linux,!netbsd,!solaris,!windows
|
||||||
|
|
||||||
package viper
|
package viper
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"fmt"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
"github.com/fsnotify/fsnotify"
|
"github.com/fsnotify/fsnotify"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func newWatcher() (*watcher, error) {
|
||||||
|
return &watcher{}, fmt.Errorf("fsnotify not supported on %s", runtime.GOOS)
|
||||||
|
}
|
||||||
|
|
||||||
type watcher struct {
|
type watcher struct {
|
||||||
Events chan fsnotify.Event
|
Events chan fsnotify.Event
|
||||||
Errors chan error
|
Errors chan error
|
||||||
|
@ -25,7 +30,3 @@ func (*watcher) Add(name string) error {
|
||||||
func (*watcher) Remove(name string) error {
|
func (*watcher) Remove(name string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newWatcher() (*watcher, error) {
|
|
||||||
return &watcher{}, errors.New("fsnotify is not supported on WASM")
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue