Fixed importing the same directory twice

This commit is contained in:
Eduard Urbach 2024-07-19 11:43:20 +02:00
parent 733c12d413
commit 7490a32666
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
2 changed files with 7 additions and 0 deletions

View File

@ -11,4 +11,5 @@ type Scanner struct {
functions chan *core.Function
errors chan error
group sync.WaitGroup
queued sync.Map
}

View File

@ -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