| 85 | } |
| 86 | |
| 87 | func processPath(pathList []string, fileCh chan<- *file) { |
| 88 | for _, path := range pathList { |
| 89 | real, err := realpath.Realpath(path) |
| 90 | checkErr(err) |
| 91 | |
| 92 | err = filepath.Walk(real, func(path string, f os.FileInfo, err error) error { |
| 93 | if !f.IsDir() && filepath.Ext(path) == ".php" { |
| 94 | wg.Add(1) |
| 95 | content, err := ioutil.ReadFile(path) |
| 96 | checkErr(err) |
| 97 | fileCh <- &file{path, content} |
| 98 | } |
| 99 | return nil |
| 100 | }) |
| 101 | checkErr(err) |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | func parserWorker(fileCh <-chan *file, r chan<- result) { |
| 106 | for { |