From a2cea8fd9142a6d2062bfc8a5a774a1396525981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E6=9D=A5=E5=86=AC=E9=A3=8E?= <2645477756@qq.com> Date: Sun, 19 Mar 2023 13:04:07 +0800 Subject: [PATCH] Avoid panic after connection failure Download function, when client.Do returns err= Nil, return false after printing the error message to avoid panic --- src/web/web.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/web/web.go b/src/web/web.go index d23d784..c4720a0 100644 --- a/src/web/web.go +++ b/src/web/web.go @@ -107,6 +107,7 @@ func Download(url string, target string, version string) bool { response, err := client.Do(req) if err != nil { fmt.Println("Error while downloading", url, "-", err) + return false } defer response.Body.Close() c := make(chan os.Signal, 2)