From e2c16cdafff8af604ad9be2277f926e1a24922ee Mon Sep 17 00:00:00 2001 From: Alain Gilbert Date: Thu, 18 Aug 2022 04:59:33 -0700 Subject: [PATCH] useless --- ogame.go | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/ogame.go b/ogame.go index a2e53e09..c54f4b9b 100644 --- a/ogame.go +++ b/ogame.go @@ -367,11 +367,7 @@ func execLoginLink(b *OGame, loginLink string) ([]byte, error) { if err != nil { return nil, err } - defer func() { - if err := resp.Body.Close(); err != nil { - b.error(err) - } - }() + defer resp.Body.Close() return readBody(resp) } @@ -973,11 +969,7 @@ func (b *OGame) connectChatV8(host, port string) { b.error("failed to get socket.io token:", err) return } - defer func() { - if err := resp.Body.Close(); err != nil { - b.error(err) - } - }() + defer resp.Body.Close() b.chatRetry.Reset() by, _ := ioutil.ReadAll(resp.Body) m := regexp.MustCompile(`"sid":"([^"]+)"`).FindSubmatch(by) @@ -1154,11 +1146,7 @@ func (b *OGame) connectChatV7(host, port string) { b.error("failed to get socket.io token:", err) return } - defer func() { - if err := resp.Body.Close(); err != nil { - b.error(err) - } - }() + defer resp.Body.Close() b.chatRetry.Reset() by, _ := ioutil.ReadAll(resp.Body) token := strings.Split(string(by), ":")[0] @@ -2993,11 +2981,7 @@ func (b *OGame) setResourceSettings(planetID PlanetID, settings ResourceSettings if err != nil { return err } - defer func() { - if err := resp.Body.Close(); err != nil { - b.error(err) - } - }() + defer resp.Body.Close() return nil } @@ -4121,11 +4105,7 @@ func (b *OGame) getPublicIP() (string, error) { if err != nil { return "", err } - defer func() { - if err := resp.Body.Close(); err != nil { - b.error(err) - } - }() + defer resp.Body.Close() by, err := readBody(resp) if err != nil { return "", err