Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code cleanup and refactoring #74403

Merged
merged 1 commit into from
Feb 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 5 additions & 11 deletions cmd/kubeadm/app/preflight/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
}
Expand Down