diff --git a/pkg/find/file.go b/pkg/find/file.go index 375ebe1..112976d 100644 --- a/pkg/find/file.go +++ b/pkg/find/file.go @@ -42,7 +42,7 @@ func (o *Options) crawlFiles() (*Result, error) { // Create the collector settings coOptions := []func(*colly.Collector){ colly.AllowedDomains(allowedDomains...), - colly.Async(false), + colly.Async(true), } if o.Verbose { @@ -92,5 +92,8 @@ func (o *Options) crawlFiles() (*Result, error) { } } + // Wait until colly goroutines are finished. + co.Wait() + return &Result{BaseNames: files, URLs: urls}, nil } diff --git a/pkg/find/folder.go b/pkg/find/folder.go index 0dfdd47..99ec213 100644 --- a/pkg/find/folder.go +++ b/pkg/find/folder.go @@ -43,7 +43,7 @@ func (o *Options) crawlFolders() (*Result, error) { // Create the collector settings coOptions := []func(*colly.Collector){ colly.AllowedDomains(allowedDomains...), - colly.Async(false), + colly.Async(true), } if o.Verbose { @@ -100,5 +100,8 @@ func (o *Options) crawlFolders() (*Result, error) { } } + // Wait until colly goroutines are finished. + co.Wait() + return &Result{BaseNames: folders, URLs: urls}, nil }