mirror of
https://github.com/spf13/viper
synced 2024-12-23 12:07:02 +00:00
call onConfigChange callback only if it is not nil, so i really become
an optional parameter.
This commit is contained in:
parent
15738813a0
commit
e919dff7ac
1 changed files with 3 additions and 1 deletions
4
viper.go
4
viper.go
|
@ -289,7 +289,9 @@ func (v *Viper) WatchConfig() {
|
|||
if err != nil {
|
||||
log.Println("error:", err)
|
||||
}
|
||||
v.onConfigChange(event)
|
||||
if v.onConfigChange != nil {
|
||||
v.onConfigChange(event)
|
||||
}
|
||||
}
|
||||
}
|
||||
case err := <-watcher.Errors:
|
||||
|
|
Loading…
Reference in a new issue