Fixed importing the same directory twice
This commit is contained in:
parent
733c12d413
commit
7490a32666
2 changed files with 7 additions and 0 deletions
|
@ -11,4 +11,5 @@ type Scanner struct {
|
|||
functions chan *core.Function
|
||||
errors chan error
|
||||
group sync.WaitGroup
|
||||
queued sync.Map
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue