Fixed importing the same directory twice

This commit is contained in:
Eduard Urbach 2024-07-19 11:43:20 +02:00
parent 84b4731815
commit b776775f8f
Signed by: eduard
GPG key ID: 49226B848C78F6C8
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