reduce nesting

This commit is contained in:
technicianted 2018-03-09 21:03:22 -08:00
parent 659d9df117
commit 0fb8072b19

View File

@ -176,13 +176,11 @@ func (prober *flexVolumeProber) updateProbeNeeded() {
// on its parent directory. // on its parent directory.
func (prober *flexVolumeProber) addWatchRecursive(filename string) error { func (prober *flexVolumeProber) addWatchRecursive(filename string) error {
addWatch := func(path string, info os.FileInfo, err error) error { addWatch := func(path string, info os.FileInfo, err error) error {
if err == nil { if err == nil && info.IsDir() {
if info.IsDir() {
if err := prober.watcher.AddWatch(path); err != nil { if err := prober.watcher.AddWatch(path); err != nil {
glog.Errorf("Error recursively adding watch: %v", err) glog.Errorf("Error recursively adding watch: %v", err)
} }
} }
}
return nil return nil
} }
return prober.fs.Walk(filename, addWatch) return prober.fs.Walk(filename, addWatch)