Small if err cleaning
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
This commit is contained in:
parent
54aab2e9b8
commit
9a26753d41
2 changed files with 2 additions and 5 deletions
|
@ -597,8 +597,7 @@ func (r *Session) SearchRepositories(term string) (*SearchResults, error) {
|
||||||
return nil, httputils.NewHTTPRequestError(fmt.Sprintf("Unexpected status code %d", res.StatusCode), res)
|
return nil, httputils.NewHTTPRequestError(fmt.Sprintf("Unexpected status code %d", res.StatusCode), res)
|
||||||
}
|
}
|
||||||
result := new(SearchResults)
|
result := new(SearchResults)
|
||||||
err = json.NewDecoder(res.Body).Decode(result)
|
return result, json.NewDecoder(res.Body).Decode(result)
|
||||||
return result, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Session) GetAuthConfig(withPasswd bool) *cliconfig.AuthConfig {
|
func (r *Session) GetAuthConfig(withPasswd bool) *cliconfig.AuthConfig {
|
||||||
|
|
|
@ -387,10 +387,8 @@ func (r *Session) GetV2RemoteTags(ep *Endpoint, imageName string, auth *RequestA
|
||||||
return nil, httputils.NewHTTPRequestError(fmt.Sprintf("Server error: %d trying to fetch for %s", res.StatusCode, imageName), res)
|
return nil, httputils.NewHTTPRequestError(fmt.Sprintf("Server error: %d trying to fetch for %s", res.StatusCode, imageName), res)
|
||||||
}
|
}
|
||||||
|
|
||||||
decoder := json.NewDecoder(res.Body)
|
|
||||||
var remote remoteTags
|
var remote remoteTags
|
||||||
err = decoder.Decode(&remote)
|
if err := json.NewDecoder(res.Body).Decode(&remote); err != nil {
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("Error while decoding the http response: %s", err)
|
return nil, fmt.Errorf("Error while decoding the http response: %s", err)
|
||||||
}
|
}
|
||||||
return remote.Tags, nil
|
return remote.Tags, nil
|
||||||
|
|
Loading…
Reference in a new issue