diff --git a/src/build/scanner/Scanner.go b/src/build/scanner/Scanner.go index 9725e3b..ff6ea26 100644 --- a/src/build/scanner/Scanner.go +++ b/src/build/scanner/Scanner.go @@ -11,4 +11,5 @@ type Scanner struct { functions chan *core.Function errors chan error group sync.WaitGroup + queued sync.Map } diff --git a/src/build/scanner/queueDirectory.go b/src/build/scanner/queueDirectory.go index 21b32e8..d21c8ce 100644 --- a/src/build/scanner/queueDirectory.go +++ b/src/build/scanner/queueDirectory.go @@ -9,6 +9,12 @@ import ( // queueDirectory queues an entire directory to be scanned. func (s *Scanner) queueDirectory(directory string, pkg string) { + _, loaded := s.queued.LoadOrStore(directory, nil) + + if loaded { + return + } + err := fs.Walk(directory, func(name string) { if !strings.HasSuffix(name, ".q") { return