diff --git a/pkg/api/check_version.go b/pkg/api/check_version.go index c0eb7370e..4e4ed3fe7 100644 --- a/pkg/api/check_version.go +++ b/pkg/api/check_version.go @@ -124,14 +124,14 @@ func GetLatestVersion(shortHash bool) (latestVersion string, latestRelease strin release := githubReleasesResponse{} - if response.StatusCode != http.StatusOK { - return "", "", fmt.Errorf("Github API request failed: %s", response.Status) - } - if err != nil { return "", "", fmt.Errorf("Github API request failed: %s", err) } + if response.StatusCode != http.StatusOK { + return "", "", fmt.Errorf("Github API request failed: %s", response.Status) + } + defer response.Body.Close() data, err := ioutil.ReadAll(response.Body)