Merge pull request #13471 from wangjingcun/main

Use a more direct and less error-prone return value
pull/30553/head
Matt Farina 7 months ago committed by GitHub
commit 8edc3ac024
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -155,5 +155,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…
Cancel
Save