mirror of
https://github.com/spf13/viper
synced 2024-12-22 19:47:01 +00:00
refactor: drop fsonitfy wrapper
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
parent
6db0ab274d
commit
464cdab72a
3 changed files with 1 additions and 43 deletions
2
viper.go
2
viper.go
|
@ -439,7 +439,7 @@ func (v *Viper) WatchConfig() {
|
||||||
initWG := sync.WaitGroup{}
|
initWG := sync.WaitGroup{}
|
||||||
initWG.Add(1)
|
initWG.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
watcher, err := newWatcher()
|
watcher, err := fsnotify.NewWatcher()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
v.logger.Error(fmt.Sprintf("failed to create watcher: %s", err))
|
v.logger.Error(fmt.Sprintf("failed to create watcher: %s", err))
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
11
watch.go
11
watch.go
|
@ -1,11 +0,0 @@
|
||||||
//go:build darwin || dragonfly || freebsd || openbsd || linux || netbsd || solaris || windows
|
|
||||||
|
|
||||||
package viper
|
|
||||||
|
|
||||||
import "github.com/fsnotify/fsnotify"
|
|
||||||
|
|
||||||
type watcher = fsnotify.Watcher
|
|
||||||
|
|
||||||
func newWatcher() (*watcher, error) {
|
|
||||||
return fsnotify.NewWatcher()
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
//go:build appengine || (!darwin && !dragonfly && !freebsd && !openbsd && !linux && !netbsd && !solaris && !windows)
|
|
||||||
|
|
||||||
package viper
|
|
||||||
|
|
||||||
import (
|
|
||||||
"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
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*watcher) Close() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*watcher) Add(name string) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*watcher) Remove(name string) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
Loading…
Reference in a new issue