From c2e79fdcbf41cb4e53b40366f303b40ba8ded53f Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Thu, 22 Aug 2019 09:53:56 +0200 Subject: [PATCH] chore: added defer instructions --- functions.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/functions.go b/functions.go index cee7429..22a702c 100644 --- a/functions.go +++ b/functions.go @@ -66,6 +66,8 @@ func FetchData(wc *WeatherConfig, city string) (Data, error) { return Data{}, err } + defer r.Body.Close() + b, err := ioutil.ReadAll(r.Body) if err != nil { return Data{}, err @@ -95,6 +97,7 @@ func SendToInflux(wc *WeatherConfig, d Data) error { if err != nil { return err } + defer httpClient.Close() bp, err := client.NewBatchPoints(client.BatchPointsConfig{ Database: wc.InfluxDB,