Skip to content

Commit 8ec60b6

Browse files
committed
added WaitGroups
1 parent b359add commit 8ec60b6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bufio"
55
"log"
66
"os"
7+
"sync"
78

89
"github.com/valyala/fasthttp"
910
)
@@ -43,9 +44,13 @@ func main() {
4344
}
4445
defer file.Close()
4546

47+
var wg sync.WaitGroup
48+
4649
scanner := bufio.NewScanner(file)
4750
scanner.Split(bufio.ScanLines)
4851
for scanner.Scan() {
49-
checkToken(scanner.Text())
52+
wg.Add(1)
53+
go checkToken(scanner.Text())
5054
}
55+
wg.Wait()
5156
}

0 commit comments

Comments
 (0)