package main
import (
"fmt"
"net/http"
"sync"
"time"
)
var wg sync.WaitGroup
func getResp() {
defer wg.Done()
res, err := http.Get("http://ya.ru")
if err != nil {
fmt.Println(err)
} else {
fmt.Println(res.Status)
}
}
func main() {
start := time.Now()
for i := 0; i < 10; i++ {
wg.Add(1)
go getResp()
}
wg.Wait()
elapsed := time.Since(start)
fmt.Println("Время выполнения ", elapsed)
}