q/src/build/scanner/Scan.go

20 lines
421 B
Go

package scanner
import "git.akyoto.dev/cli/q/src/build/core"
// Scan scans the list of files.
func Scan(files []string) (<-chan *core.Function, <-chan error) {
scanner := Scanner{
functions: make(chan *core.Function),
errors: make(chan error),
}
go func() {
scanner.queue(files...)
scanner.group.Wait()
close(scanner.functions)
close(scanner.errors)
}()
return scanner.functions, scanner.errors
}