docscanner/cmd/scanner/main.go
- Parse CLI arguments and validate that a root directory is provided
- Create channels for file paths and scan results
- Construct the list of active analyzers (Word + PDF)
- Kick off directory walking and the worker pool
- Wait for workers to finish and aggregate results
- Encode results as pretty-printed JSON to stdout
- Read
root := os.Args[1]. - Create
files(chan string) andresults(chan *model.ScanResult). - Instantiate analyzers:
&analyzer.WordAnalyzer{}&analyzer.PDFAnalyzer{}
- Start directory walking with
scanner.WalkDirectory(root, files). - Start workers with
scanner.StartWorkerPool(runtime.NumCPU(), files, analyzers, results, &wg). - Wait for all workers via
WaitGroup, then closeresults. - Collect all results and marshal them with
json.MarshalIndent.
The CLI does not know about any analyzer internals; it only wires together the pieces.