From 1b1ea9c5eaa3c3f872724783898ede302bf8afdc Mon Sep 17 00:00:00 2001 From: Theodore Chang Date: Mon, 18 Nov 2024 21:15:51 +0100 Subject: [PATCH] Minor update --- Checker/updater.go | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/Checker/updater.go b/Checker/updater.go index ae265f188..57df37b54 100644 --- a/Checker/updater.go +++ b/Checker/updater.go @@ -24,13 +24,7 @@ func main() { if err != nil { return } - - defer func(Body io.ReadCloser) { - err := Body.Close() - if err != nil { - return - } - }(response.Body) + defer response.Body.Close() html, err := io.ReadAll(response.Body) if err != nil { @@ -155,23 +149,13 @@ func downloadLatestVersion(versionString string) error { if err != nil { return err } - defer func(Body io.ReadCloser) { - err := Body.Close() - if err != nil { - return - } - }(response.Body) + defer response.Body.Close() storage, err := os.Create(fileName) if err != nil { return err } - defer func(storage *os.File) { - err := storage.Close() - if err != nil { - return - } - }(storage) + defer storage.Close() _, _ = io.Copy(storage, response.Body)