mirror of
https://github.com/helm/helm.git
synced 2026-04-26 00:27:36 -04:00
Use a more direct and less error-prone return value
Signed-off-by: wangjingcun <wangjingcun@aliyun.com>
This commit is contained in:
parent
a142da0811
commit
8b8cc94822
4 changed files with 7 additions and 7 deletions
|
|
@ -143,5 +143,5 @@ func readFile(filePath string, p getter.Providers) ([]byte, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return data.Bytes(), err
|
||||
return data.Bytes(), nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ func (rt *RetryingRoundTripper) roundTrip(req *http.Request, retry int, prevResp
|
|||
b, err := io.ReadAll(resp.Body)
|
||||
resp.Body.Close()
|
||||
if err != nil {
|
||||
return resp, rtErr
|
||||
return resp, err
|
||||
}
|
||||
|
||||
var ke kubernetesError
|
||||
|
|
@ -58,10 +58,10 @@ func (rt *RetryingRoundTripper) roundTrip(req *http.Request, retry int, prevResp
|
|||
r.Seek(0, io.SeekStart)
|
||||
resp.Body = io.NopCloser(r)
|
||||
if err != nil {
|
||||
return resp, rtErr
|
||||
return resp, nil
|
||||
}
|
||||
if ke.Code < 500 {
|
||||
return resp, rtErr
|
||||
return resp, nil
|
||||
}
|
||||
// Matches messages like "etcdserver: leader changed"
|
||||
if strings.HasSuffix(ke.Message, "etcdserver: leader changed") {
|
||||
|
|
@ -71,7 +71,7 @@ func (rt *RetryingRoundTripper) roundTrip(req *http.Request, retry int, prevResp
|
|||
if strings.HasSuffix(ke.Message, "raft proposal dropped") {
|
||||
return rt.roundTrip(req, retry-1, resp)
|
||||
}
|
||||
return resp, rtErr
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
type kubernetesError struct {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ func NewVCSInstaller(source, version string) (*VCSInstaller, error) {
|
|||
Version: version,
|
||||
base: newBase(source),
|
||||
}
|
||||
return i, err
|
||||
return i, nil
|
||||
}
|
||||
|
||||
// Install clones a remote repository and installs into the plugin directory.
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ const (
|
|||
// phrase. Use `gpg --export-secret-keys helm-test` to export the secret.
|
||||
testKeyfile = "testdata/helm-test-key.secret"
|
||||
|
||||
// testPasswordKeyFile is a keyfile with a password.
|
||||
// testPasswordKeyfile is a keyfile with a password.
|
||||
testPasswordKeyfile = "testdata/helm-password-key.secret"
|
||||
|
||||
// testPubfile is the public key file.
|
||||
|
|
|
|||
Loading…
Reference in a new issue