Fixed importing the same directory twice
This commit is contained in:
parent
733c12d413
commit
7490a32666
@ -11,4 +11,5 @@ type Scanner struct {
|
|||||||
functions chan *core.Function
|
functions chan *core.Function
|
||||||
errors chan error
|
errors chan error
|
||||||
group sync.WaitGroup
|
group sync.WaitGroup
|
||||||
|
queued sync.Map
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,12 @@ import (
|
|||||||
|
|
||||||
// queueDirectory queues an entire directory to be scanned.
|
// queueDirectory queues an entire directory to be scanned.
|
||||||
func (s *Scanner) queueDirectory(directory string, pkg string) {
|
func (s *Scanner) queueDirectory(directory string, pkg string) {
|
||||||
|
_, loaded := s.queued.LoadOrStore(directory, nil)
|
||||||
|
|
||||||
|
if loaded {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
err := fs.Walk(directory, func(name string) {
|
err := fs.Walk(directory, func(name string) {
|
||||||
if !strings.HasSuffix(name, ".q") {
|
if !strings.HasSuffix(name, ".q") {
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user