chore: added defer instructions

This commit is contained in:
Paul Lecuq 2019-08-22 09:53:56 +02:00
parent 72e5b16b7a
commit c2e79fdcbf

View File

@ -66,6 +66,8 @@ func FetchData(wc *WeatherConfig, city string) (Data, error) {
return Data{}, err return Data{}, err
} }
defer r.Body.Close()
b, err := ioutil.ReadAll(r.Body) b, err := ioutil.ReadAll(r.Body)
if err != nil { if err != nil {
return Data{}, err return Data{}, err
@ -95,6 +97,7 @@ func SendToInflux(wc *WeatherConfig, d Data) error {
if err != nil { if err != nil {
return err return err
} }
defer httpClient.Close()
bp, err := client.NewBatchPoints(client.BatchPointsConfig{ bp, err := client.NewBatchPoints(client.BatchPointsConfig{
Database: wc.InfluxDB, Database: wc.InfluxDB,