config: service, but ignore error channel.
This commit is contained in:
+2
-5
@@ -66,7 +66,6 @@ type EncodeConfig func(w io.Writer, v interface{}) error
|
|||||||
type WatchConfig struct {
|
type WatchConfig struct {
|
||||||
// Notified here if the file changes.
|
// Notified here if the file changes.
|
||||||
C chan *WatchConfig
|
C chan *WatchConfig
|
||||||
Err chan error
|
|
||||||
|
|
||||||
filepath string
|
filepath string
|
||||||
watch *fsnotify.Watcher
|
watch *fsnotify.Watcher
|
||||||
@@ -108,7 +107,6 @@ func NewWatchConfig(filepath string, decode DecodeConfig, defaultConfig interfac
|
|||||||
|
|
||||||
wc := &WatchConfig{
|
wc := &WatchConfig{
|
||||||
C: make(chan *WatchConfig),
|
C: make(chan *WatchConfig),
|
||||||
Err: make(chan error),
|
|
||||||
|
|
||||||
filepath: filepath,
|
filepath: filepath,
|
||||||
watch: watch,
|
watch: watch,
|
||||||
@@ -130,10 +128,9 @@ func (wc *WatchConfig) run() {
|
|||||||
select {
|
select {
|
||||||
case <-wc.close:
|
case <-wc.close:
|
||||||
close(wc.C)
|
close(wc.C)
|
||||||
close(wc.Err)
|
|
||||||
return
|
return
|
||||||
case err := <-wc.watch.Errors:
|
case <-wc.watch.Errors:
|
||||||
wc.Err <- err
|
// Nothing right now.
|
||||||
case <-wc.watch.Events:
|
case <-wc.watch.Events:
|
||||||
trigger = true
|
trigger = true
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
|
|||||||
Reference in New Issue
Block a user