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

Support for "okteto doctor" command #719

Merged
merged 5 commits into from
Feb 28, 2020
Merged

Support for "okteto doctor" command #719

merged 5 commits into from
Feb 28, 2020

Conversation

pchico83
Copy link
Contributor

Closes #663

}
fmt.Fprintf(fileSummary, "version=%s\n", config.VersionString)
fmt.Fprintf(fileSummary, "os=%s\n", runtime.GOOS)
fileSummary.Sync()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of fileSummary.Sync is not checked (from errcheck)

return "", err
}
fmt.Fprint(fileRemoteLog, remoteLogs)
fileRemoteLog.Sync()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of fileRemoteLog.Sync is not checked (from errcheck)

@codecov
Copy link

codecov bot commented Feb 27, 2020

Codecov Report

Merging #719 into master will decrease coverage by 0.32%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #719      +/-   ##
==========================================
- Coverage   31.98%   31.65%   -0.33%     
==========================================
  Files          58       59       +1     
  Lines        4549     4596      +47     
==========================================
  Hits         1455     1455              
- Misses       2999     3046      +47     
  Partials       95       95
Impacted Files Coverage Δ
cmd/status.go 0% <ø> (ø) ⬆️
cmd/up.go 6% <0%> (ø) ⬆️
pkg/config/config.go 11.9% <0%> (-0.6%) ⬇️
cmd/doctor.go 0% <0%> (ø)
pkg/syncthing/syncthing.go 0.58% <0%> (ø) ⬆️
pkg/analytics/analytics.go 16.55% <0%> (-0.24%) ⬇️
pkg/k8s/pods/pod.go 10.16% <0%> (-0.89%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0d98343...77e314e. Read the comment docs.

if err != nil {
log.Yellow("Failed to query remote syncthing logs: %s", err)
}
if remoteLogsPath != "" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this check necessary if there's no error?

return fmt.Errorf("couldn't create archive, please try again")
}

log.Information("Your doctor file was generated at %s", archiveName)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't call log.Information outside of the cmd package, so we can control UI elements there. I think you can return the file and do the notification there.

return "", err
}
fmt.Fprintf(fileSummary, "version=%s\n", config.VersionString)
fmt.Fprintf(fileSummary, "os=%s\n", runtime.GOOS)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the arch as well

if err := fileSummary.Sync(); err != nil {
return "", err
}
fileSummary.Close()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put it as defer fileSummary.Close() in line 82 instead.

if err != nil {
return "", err
}
fmt.Fprintf(fileSummary, "version=%s\n", config.VersionString)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably check the error of Fprintf. Maybe create the string first and just write once?

pkg/cmd/doctor/run.go Outdated Show resolved Hide resolved
pkg/cmd/doctor/run.go Outdated Show resolved Hide resolved
cmd/doctor.go Outdated Show resolved Hide resolved
pchico83 and others added 5 commits February 28, 2020 07:17
Co-Authored-By: Ramiro Berrelleza <ramiro@okteto.com>
Co-Authored-By: Ramiro Berrelleza <ramiro@okteto.com>
Co-Authored-By: Ramiro Berrelleza <ramiro@okteto.com>
@pchico83 pchico83 merged commit b9e9bfb into master Feb 28, 2020
@pchico83 pchico83 deleted the doctor-cmd branch February 28, 2020 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for "okteto doctor" command
3 participants