package scanner import ( "path/filepath" "git.urbach.dev/cli/q/src/config" "git.urbach.dev/cli/q/src/core" "git.urbach.dev/cli/q/src/fs" "git.urbach.dev/cli/q/src/types" ) // Scan scans the list of files. func Scan(files []string) (chan *core.Constant, <-chan *fs.File, <-chan *core.Function, <-chan *types.Struct, <-chan error) { scanner := Scanner{ constants: make(chan *core.Constant), files: make(chan *fs.File), functions: make(chan *core.Function), structs: make(chan *types.Struct), errors: make(chan error), } go func() { scanner.queueDirectory(filepath.Join(config.Library, "core"), "core") scanner.queueDirectory(filepath.Join(config.Library, "mem"), "mem") scanner.queue(files...) scanner.group.Wait() close(scanner.constants) close(scanner.files) close(scanner.functions) close(scanner.structs) close(scanner.errors) }() return scanner.constants, scanner.files, scanner.functions, scanner.structs, scanner.errors }