Replaced Fatal with Panic in urlfetch

This commit is contained in:
Egor 2024-06-05 22:57:17 +03:00
parent 6e6c742228
commit e0ed0a4cde

View file

@ -15,12 +15,12 @@ func main() {
for _, url := range urls { for _, url := range urls {
resp, err := http.Get(url) resp, err := http.Get(url)
if err != nil { if err != nil {
log.Fatal("fetch:", err) log.Panic("fetch:", err)
} }
defer resp.Body.Close() defer resp.Body.Close()
body, err := io.ReadAll(resp.Body) body, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
log.Fatal("fetch:", err) log.Panic("fetch:", err)
} }
fmt.Println(string(body)) fmt.Println(string(body))
} }