コード例 #1
0
ファイル: main.go プロジェクト: wxdublin/clamav
// 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.ScanFileCb(path, clamav.ScanStdopt|clamav.ScanAllmatches, path)
			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
}