From a3ea6d220f5856e0e915ed098258039dc76205b8 Mon Sep 17 00:00:00 2001 From: Baruch Odem Date: Wed, 21 Jun 2023 19:42:21 +0300 Subject: [PATCH] fix: crash when using filesystem plugin Fixes #99 --- plugins/filesystem.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/filesystem.go b/plugins/filesystem.go index 4fd4ba23..8c1ca2d4 100644 --- a/plugins/filesystem.go +++ b/plugins/filesystem.go @@ -77,6 +77,7 @@ func (p *FileSystemPlugin) getItems(items chan Item, errs chan error, wg *sync.W for _, filePath := range fileList { wg.Add(1) go func(filePath string) { + defer wg.Done() actualFile, err := p.getItem(wg, filePath) if err != nil { errs <- err @@ -88,7 +89,6 @@ func (p *FileSystemPlugin) getItems(items chan Item, errs chan error, wg *sync.W } func (p *FileSystemPlugin) getItem(wg *sync.WaitGroup, filePath string) (*Item, error) { - defer wg.Done() b, err := os.ReadFile(filePath) if err != nil { return nil, err