Unverified Commit 8326ea71 authored by Kubernetes Prow Robot's avatar Kubernetes Prow Robot Committed by GitHub

Merge pull request #74403 from ping035627/k8s-190222

Code cleanup and refactoring
parents d834885a 8fef7221
......@@ -1070,7 +1070,7 @@ func RunChecks(checks []Checker, ww io.Writer, ignorePreflightErrors sets.String
Name string
Errors []error
}
found := []checkErrors{}
var errsBuffer bytes.Buffer
for _, c := range checks {
name := c.Name()
......@@ -1085,18 +1085,12 @@ func RunChecks(checks []Checker, ww io.Writer, ignorePreflightErrors sets.String
for _, w := range warnings {
io.WriteString(ww, fmt.Sprintf("\t[WARNING %s]: %v\n", name, w))
}
if len(errs) > 0 {
found = append(found, checkErrors{Name: name, Errors: errs})
for _, i := range errs {
errsBuffer.WriteString(fmt.Sprintf("\t[ERROR %s]: %v\n", name, i.Error()))
}
}
if len(found) > 0 {
var errs bytes.Buffer
for _, c := range found {
for _, i := range c.Errors {
errs.WriteString(fmt.Sprintf("\t[ERROR %s]: %v\n", c.Name, i.Error()))
}
}
return &Error{Msg: errs.String()}
if errsBuffer.Len() > 0 {
return &Error{Msg: errsBuffer.String()}
}
return nil
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment