// Workers receive file names on 'in', scan them, and output the results on 'out' func worker(in, cnt chan string, done chan bool, engine *clamav.Engine) { for path := range in { if *debug { log.Printf("scanning %s", path) } if *scan { virus, _, err := engine.ScanFile(path, clamav.ScanStdopt|clamav.ScanAllmatches) if virus != "" { log.Printf("virus found in %s: %s", path, virus) } else if err != nil { log.Printf("error scanning %s: %v", path, err) } } } done <- true }