Skip to content

Commit dcb7f30

Browse files
committed
feat: fix compilation for all platforms unsupported by fsnotify
Signed-off-by: Mark Sagi-Kazar <[email protected]>
1 parent 2e04739 commit dcb7f30

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

watch.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//go:build !js && !aix
2-
// +build !js,!aix
1+
//go:build darwin || dragonfly || freebsd || openbsd || linux || netbsd || solaris || windows
2+
// +build darwin dragonfly freebsd openbsd linux netbsd solaris windows
33

44
package viper
55

watch_disabled.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
//go:build js || aix
2-
// +build js aix
1+
//go:build !darwin && !dragonfly && !freebsd && !openbsd && !linux && !netbsd && !solaris && !windows
2+
// +build !darwin,!dragonfly,!freebsd,!openbsd,!linux,!netbsd,!solaris,!windows
33

44
package viper
55

66
import (
7-
"errors"
7+
"fmt"
8+
"runtime"
89

910
"github.com/fsnotify/fsnotify"
1011
)
1112

13+
func newWatcher() (*watcher, error) {
14+
return &watcher{}, fmt.Errorf("fsnotify not supported on %s", runtime.GOOS)
15+
}
16+
1217
type watcher struct {
1318
Events chan fsnotify.Event
1419
Errors chan error
@@ -25,7 +30,3 @@ func (*watcher) Add(name string) error {
2530
func (*watcher) Remove(name string) error {
2631
return nil
2732
}
28-
29-
func newWatcher() (*watcher, error) {
30-
return &watcher{}, errors.New("fsnotify is not supported on WASM")
31-
}

0 commit comments

Comments
 (0)