Sobes.tech

// Fix the code so that the requests are concurrent and the response code is output // and in case of an error - output its log and continue processing package main import "net/http" var addrs = []string{"[link]", "[link]"} func main() { for _, url := range addrs { resp, err := http.Get(url) if err != nil { log.err return } } }

180

// Fix the code so that requests are concurrent and the response code is displayed // and in case of error - log it and continue processing package main import "net/http" var addrs = []string{"[link] "[link] "[link] "[link] "[link] "[link] "[link] func main() { wg := sync.WaitGroup{} data := make(map[string]bool) for _, url := range addrs { wg.Add(1) if !data[url]{ data[url] = true go func(url string){ defer wg.Done() resp, err := http.Get(url) if err != nil { log.err return } log.info }(url) } } wg.Wait() }

154