diff --git a/ch-5/subdomain_guesser/main.go b/ch-5/subdomain_guesser/main.go index 3ebff26..0b784fb 100644 --- a/ch-5/subdomain_guesser/main.go +++ b/ch-5/subdomain_guesser/main.go @@ -119,11 +119,6 @@ func main() { go worker(tracker, fqdns, gather, *flServerAddr) } - for scanner.Scan() { - fqdns <- fmt.Sprintf("%s.%s", scanner.Text(), *flDomain) - } - // Note: We could check scanner.Err() here. - go func() { for r := range gather { results = append(results, r...) @@ -132,6 +127,11 @@ func main() { tracker <- e }() + for scanner.Scan() { + fqdns <- fmt.Sprintf("%s.%s", scanner.Text(), *flDomain) + } + // Note: We could check scanner.Err() here. + close(fqdns) for i := 0; i < *flWorkerCount; i++ { <-tracker