Skip to content

Commit

Permalink
feat: fix compilation for all platforms unsupported by fsnotify
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
  • Loading branch information
sagikazarmark committed Nov 4, 2022
1 parent 2e04739 commit dcb7f30
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions watch.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build !js && !aix
// +build !js,!aix
//go:build darwin || dragonfly || freebsd || openbsd || linux || netbsd || solaris || windows
// +build darwin dragonfly freebsd openbsd linux netbsd solaris windows

package viper

Expand Down
15 changes: 8 additions & 7 deletions watch_disabled.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
//go:build js || aix
// +build js aix
//go:build !darwin && !dragonfly && !freebsd && !openbsd && !linux && !netbsd && !solaris && !windows
// +build !darwin,!dragonfly,!freebsd,!openbsd,!linux,!netbsd,!solaris,!windows

package viper

import (
"errors"
"fmt"
"runtime"

"github.com/fsnotify/fsnotify"
)

func newWatcher() (*watcher, error) {
return &watcher{}, fmt.Errorf("fsnotify not supported on %s", runtime.GOOS)
}

type watcher struct {
Events chan fsnotify.Event
Errors chan error
Expand All @@ -25,7 +30,3 @@ func (*watcher) Add(name string) error {
func (*watcher) Remove(name string) error {
return nil
}

func newWatcher() (*watcher, error) {
return &watcher{}, errors.New("fsnotify is not supported on WASM")
}

0 comments on commit dcb7f30

Please sign in to comment.