-
Notifications
You must be signed in to change notification settings - Fork 4
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
Adding Temperature 🌡️ to Inspectors 🧐 #27
Adding Temperature 🌡️ to Inspectors 🧐 #27
Conversation
inspector/inspector.go
Outdated
@@ -29,6 +29,7 @@ var inspectorMap = map[string]NewInspector{ | |||
`process`: NewProcess, | |||
`loadavg`: NewLoadAvg, | |||
`tcp`: NewTcp, | |||
`temperature`: NewTemp, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the spirit of short forms temperature seems too long... maybe just temp
inspector/temp.go
Outdated
return nil, errors.New("Cannot use 'temp' command on drivers outside (linux, darwin, windows)") | ||
} | ||
|
||
// $ cat /sys/class/thermal/thermal_zone*/temp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to the Parse method of the platform specific inspector
inspector/temp.go
Outdated
output = strings.ReplaceAll(output, " ", "") | ||
value, err := strconv.ParseFloat(output, 64) | ||
if err != nil { | ||
log.Fatalf(`Error Parsing Temperature: %s `, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try not to fatally kill everybody.... just turn this to an Errorf on parsing issues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for other Fatals ... whenever the function can't return an error, just use Errorf but if it can return an error then return it
fd70e50
to
5be290b
Compare
5be290b
to
ba321ba
Compare
Closing as inconsistent |
This pr solves #23
TODO