This commit is contained in:
parent
9b51680af5
commit
c2b8db238e
24 changed files with 624 additions and 232 deletions
|
@ -2,23 +2,26 @@ package scanner
|
|||
|
||||
import (
|
||||
"git.urbach.dev/cli/q/src/build"
|
||||
"git.urbach.dev/cli/q/src/core"
|
||||
"git.urbach.dev/cli/q/src/fs"
|
||||
)
|
||||
|
||||
// Scan scans all the files included in the build.
|
||||
func Scan(b *build.Build) (<-chan *fs.File, <-chan error) {
|
||||
func Scan(b *build.Build) (<-chan *core.Function, <-chan *fs.File, <-chan error) {
|
||||
s := scanner{
|
||||
files: make(chan *fs.File),
|
||||
errors: make(chan error),
|
||||
build: b,
|
||||
functions: make(chan *core.Function),
|
||||
files: make(chan *fs.File),
|
||||
errors: make(chan error),
|
||||
build: b,
|
||||
}
|
||||
|
||||
go func() {
|
||||
s.queue(b.Files...)
|
||||
s.group.Wait()
|
||||
close(s.functions)
|
||||
close(s.files)
|
||||
close(s.errors)
|
||||
}()
|
||||
|
||||
return s.files, s.errors
|
||||
return s.functions, s.files, s.errors
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue