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

Adding Temperature 🌡️ to Inspectors 🧐 #27

Closed

Conversation

derhnyel
Copy link
Contributor

@derhnyel derhnyel commented Dec 5, 2022

This pr solves #23

TODO

  • Add Test for new temperature inspector

@derhnyel derhnyel changed the title Adding Temperature 🌡️ to Inspector 🧐 Adding Temperature 🌡️ to Inspectors 🧐 Dec 5, 2022
@@ -29,6 +29,7 @@ var inspectorMap = map[string]NewInspector{
`process`: NewProcess,
`loadavg`: NewLoadAvg,
`tcp`: NewTcp,
`temperature`: NewTemp,
Copy link
Member

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

return nil, errors.New("Cannot use 'temp' command on drivers outside (linux, darwin, windows)")
}

// $ cat /sys/class/thermal/thermal_zone*/temp
Copy link
Member

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

output = strings.ReplaceAll(output, " ", "")
value, err := strconv.ParseFloat(output, 64)
if err != nil {
log.Fatalf(`Error Parsing Temperature: %s `, err)
Copy link
Member

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

Copy link
Member

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

@derhnyel derhnyel force-pushed the feature/test-goreleaser branch 4 times, most recently from fd70e50 to 5be290b Compare January 4, 2023 08:45
@deven96
Copy link
Member

deven96 commented Jan 6, 2023

Closing as inconsistent

@deven96 deven96 closed this Jan 6, 2023
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.

2 participants