File tree 1 file changed +2
-4
lines changed
1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -463,9 +463,8 @@ func (v *Viper) WatchConfig() {
463
463
// we only care about the config file with the following cases:
464
464
// 1 - if the config file was modified or created
465
465
// 2 - if the real path to the config file changed (eg: k8s ConfigMap replacement)
466
- const writeOrCreateMask = fsnotify .Write | fsnotify .Create
467
466
if (filepath .Clean (event .Name ) == configFile &&
468
- event .Op & writeOrCreateMask != 0 ) ||
467
+ ( event .Has ( fsnotify . Write ) || event . Has ( fsnotify . Create )) ) ||
469
468
(currentConfigFile != "" && currentConfigFile != realConfigFile ) {
470
469
realConfigFile = currentConfigFile
471
470
err := v .ReadInConfig ()
@@ -475,8 +474,7 @@ func (v *Viper) WatchConfig() {
475
474
if v .onConfigChange != nil {
476
475
v .onConfigChange (event )
477
476
}
478
- } else if filepath .Clean (event .Name ) == configFile &&
479
- event .Op & fsnotify .Remove != 0 {
477
+ } else if filepath .Clean (event .Name ) == configFile && event .Has (fsnotify .Remove ) {
480
478
eventsWG .Done ()
481
479
return
482
480
}
You can’t perform that action at this time.
0 commit comments