refactor and to go mod

This commit is contained in:
YouROK
2021-02-18 16:56:55 +03:00
parent 0e49a98626
commit 94f212fa75
50 changed files with 13 additions and 29 deletions

17
server/utils/prallel.go Normal file
View File

@@ -0,0 +1,17 @@
package utils
import (
"sync"
)
func ParallelFor(begin, end int, fn func(i int)) {
var wg sync.WaitGroup
wg.Add(end - begin)
for i := begin; i < end; i++ {
go func(i int) {
fn(i)
wg.Done()
}(i)
}
wg.Wait()
}