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

chore(linters): Fix remaining errcheck warnings #15518

Merged
merged 13 commits into from
Jul 10, 2024

Conversation

DStrand1
Copy link
Contributor

Summary

Fixes remaining errcheck warnings in input/output plugin directories and removes remaining temporary .golangci.yml exclusions

Checklist

  • No AI generated code was used in this PR

Related issues

resolves #13013

@DStrand1 DStrand1 changed the title Ci/errcheck3 chore(linters): Fix remaining errcheck warnings Jun 14, 2024
@telegraf-tiger telegraf-tiger bot added the chore label Jun 14, 2024
@DStrand1 DStrand1 added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Jun 26, 2024
@DStrand1 DStrand1 assigned powersj and srebhan and unassigned DStrand1 Jun 26, 2024
Copy link
Contributor

@powersj powersj left a comment

Choose a reason for hiding this comment

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

Thank you for doing this!! very excited about getting this turned on. I have a few spots with small changes and two questions about error messages.

plugins/inputs/amd_rocm_smi/amd_rocm_smi.go Outdated Show resolved Hide resolved
plugins/inputs/gnmi/handler.go Outdated Show resolved Hide resolved
plugins/inputs/webhooks/github/github_webhooks_test.go Outdated Show resolved Hide resolved
plugins/inputs/webhooks/mandrill/mandrill_webhooks_test.go Outdated Show resolved Hide resolved
plugins/inputs/webhooks/papertrail/papertrail_test.go Outdated Show resolved Hide resolved
plugins/inputs/webhooks/particle/particle_webhooks_test.go Outdated Show resolved Hide resolved
plugins/inputs/webhooks/particle/particle_webhooks_test.go Outdated Show resolved Hide resolved
plugins/inputs/webhooks/rollbar/rollbar_webhooks_test.go Outdated Show resolved Hide resolved
plugins/inputs/webhooks/rollbar/rollbar_webhooks_test.go Outdated Show resolved Hide resolved
Co-authored-by: Joshua Powers <powersj@fastmail.com>
@powersj powersj removed their assignment Jun 27, 2024
Copy link
Contributor

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Thanks @DStrand1 for the epic effort! A few comments/suggestions from my side...

plugins/inputs/bind/json_stats.go Outdated Show resolved Hide resolved
plugins/inputs/bind/xml_stats_v3.go Outdated Show resolved Hide resolved
Comment on lines 30 to 32
//nolint:errcheck // should fail tests later on if this read fails
b, _ := os.ReadFile(jsonFile)
return b, code
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you should return the error here. The issue is that if read fails (e.g. we specified a wrongly named file) the tests can pass when returning an empty response...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since this function was called nested a few functions deep in test cases with no access to testing.T, I decided to panic here if there is an error instead

plugins/inputs/ecs/client_test.go Outdated Show resolved Hide resolved
plugins/inputs/ecs/client_test.go Outdated Show resolved Hide resolved
plugins/inputs/http_response/http_response_test.go Outdated Show resolved Hide resolved
plugins/outputs/postgresql/postgresql_bench_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Thanks @DStrand1! Just one (actually two) suggestions left...

plugins/inputs/ecs/client_test.go Outdated Show resolved Hide resolved
@telegraf-tiger
Copy link
Contributor

telegraf-tiger bot commented Jul 8, 2024

@DStrand1 DStrand1 requested a review from srebhan July 9, 2024 18:38
@srebhan srebhan merged commit 19737fc into influxdata:master Jul 10, 2024
27 checks passed
@github-actions github-actions bot added this to the v1.31.2 milestone Jul 10, 2024
powersj pushed a commit that referenced this pull request Jul 22, 2024
Co-authored-by: Joshua Powers <powersj@fastmail.com>
(cherry picked from commit 19737fc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore linter ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Review not needed and missing blank identifiers used for error
3 participants