concurrent group is a library that supports panic recovery and concurrency limiting.
group, _ := concurrentgroup.NewGroup(context.Background(), 10)
for i := 0; i < 150; i {
group.Go(func() error {
time.Sleep(2 * time.Second)
fmt.Println("go test")
return nil
})
}
group.Wait()