Remove duplicated deferred call
Remove duplicated deferred call made by accident to close the response body.
This commit is contained in:
parent
4e9f9dc017
commit
8319f2e335
1 changed files with 2 additions and 2 deletions
4
imdb.go
4
imdb.go
|
@ -129,7 +129,7 @@ func GetMovieByTitle(title string, year string) (*MovieResult, error) {
|
||||||
|
|
||||||
r := new(MovieResult)
|
r := new(MovieResult)
|
||||||
err = json.NewDecoder(resp.Body).Decode(r)
|
err = json.NewDecoder(resp.Body).Decode(r)
|
||||||
defer resp.Body.Close()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ func GetMovieByImdbId(id string) (*MovieResult, error) {
|
||||||
|
|
||||||
r := new(MovieResult)
|
r := new(MovieResult)
|
||||||
err = json.NewDecoder(resp.Body).Decode(r)
|
err = json.NewDecoder(resp.Body).Decode(r)
|
||||||
defer resp.Body.Close()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue