Skip to content

Commit 3d9d127

Browse files
committed
Wait for output to finish
1 parent c48f174 commit 3d9d127

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

main.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -419,15 +419,19 @@ func main() {
419419
}
420420
}
421421

422+
var outputWG sync.WaitGroup
423+
dedupnames := make(map[string]struct{})
424+
outputWG.Add(1)
425+
422426
go func() {
423-
dedupnames := make(map[string]struct{})
424427
for username := range outputqueue {
425428
lcasename := strings.ToLower(username)
426429
if _, found := dedupnames[lcasename]; !found {
427430
fmt.Fprintln(output, username)
428431
dedupnames[lcasename] = struct{}{}
429432
}
430433
}
434+
outputWG.Done()
431435
}()
432436

433437
var pb *progressbar.ProgressBar
@@ -459,4 +463,5 @@ func main() {
459463

460464
jobs.Wait()
461465
close(outputqueue)
466+
outputWG.Wait()
462467
}

0 commit comments

Comments
 (0)