From 8319f2e335a242adcfb71e953ef187aad1e36733 Mon Sep 17 00:00:00 2001 From: darknesto Date: Fri, 26 Sep 2014 16:02:46 -0400 Subject: [PATCH] Remove duplicated deferred call Remove duplicated deferred call made by accident to close the response body. --- imdb.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imdb.go b/imdb.go index c3bda45..2e72371 100644 --- a/imdb.go +++ b/imdb.go @@ -129,7 +129,7 @@ func GetMovieByTitle(title string, year string) (*MovieResult, error) { r := new(MovieResult) err = json.NewDecoder(resp.Body).Decode(r) - defer resp.Body.Close() + if err != nil { return nil, err } @@ -149,7 +149,7 @@ func GetMovieByImdbId(id string) (*MovieResult, error) { r := new(MovieResult) err = json.NewDecoder(resp.Body).Decode(r) - defer resp.Body.Close() + if err != nil { return nil, err }