diff --git a/.golangci.yml b/.golangci.yml index 63200b17..d01804fa 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -45,7 +45,6 @@ linters: - makezero - mirror - misspell - - musttag - nakedret - nestif - nilerr diff --git a/cmd/gonic/gonic b/cmd/gonic/gonic new file mode 100755 index 00000000..33e4d1fc Binary files /dev/null and b/cmd/gonic/gonic differ diff --git a/scanner/scanner.go b/scanner/scanner.go index fcadecaa..9c428824 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -134,9 +134,18 @@ func (s *Scanner) ExecuteWatch(ctx context.Context) error { } batchSeen := map[string]struct{}{} + batchClean := false for { select { case <-batchT.C: + if batchClean { + if _, err := s.ScanAndClean(ScanOptions{}); err != nil { + log.Printf("error scanning: %v", err) + } + clear(batchSeen) + batchClean = false + break + } if !s.StartScanning() { break } @@ -164,6 +173,10 @@ func (s *Scanner) ExecuteWatch(ctx context.Context) error { clear(batchSeen) case event := <-watcher.Events: + if event.Op&(fsnotify.Remove) == fsnotify.Remove { + batchClean = true + break + } if event.Op&(fsnotify.Create|fsnotify.Write) == 0 { break }