Skip to content

Commit

Permalink
fix(auditbeat/fim/fsnotify): remove redundant error wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
pkoutsovasilis committed Apr 23, 2024
1 parent f0836bd commit 15b0ae3
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions auditbeat/module/file_integrity/monitor/recursive.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,18 @@ func (watcher *recursiveWatcher) watchFile(path string, info os.FileInfo) error
}

if info.IsDir() {
if err = watcher.tree.AddDir(path); err == nil {
if err = watcher.inner.Add(path); err != nil {
return fmt.Errorf("failed adding watcher to '%s': %w", path, err)
}
if err = watcher.tree.AddDir(path); err != nil {
return err
}

if err = watcher.inner.Add(path); err != nil {
return err
}
} else {
err = watcher.tree.AddFile(path)

return nil
}
return err

return watcher.tree.AddFile(path)
}

func (watcher *recursiveWatcher) addRecursive(path string) error {
Expand Down

0 comments on commit 15b0ae3

Please sign in to comment.