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

[pkg/ottl] Fix gocritic complaints #14623

Merged
merged 3 commits into from
Oct 3, 2022

Conversation

TylerHelmuth
Copy link
Member

Addresses gocritic complaints.

Related to #10466

@TylerHelmuth TylerHelmuth added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Sep 30, 2022
switch ctx.GetDataPoint().(type) {
case pmetric.NumberDataPoint:
return ctx.GetDataPoint().(pmetric.NumberDataPoint).DoubleValue()
numberDataPoint, ok := ctx.GetDataPoint().(pmetric.NumberDataPoint)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
numberDataPoint, ok := ctx.GetDataPoint().(pmetric.NumberDataPoint)
if numberDataPoint, ok := ctx.GetDataPoint().(pmetric.NumberDataPoint); ok {

I think keeping the assignment in the if statement would be a bit more succinct.

Copy link
Member Author

Choose a reason for hiding this comment

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

Youre right. I should stop multitasking

Copy link
Member

Choose a reason for hiding this comment

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

I do think it is more succinct but harder to read. It is much easier to follow the code without having to go to the "branches".

@codeboten codeboten merged commit a449d2e into open-telemetry:main Oct 3, 2022
@TylerHelmuth TylerHelmuth deleted the ottl-gocritic branch October 3, 2022 15:56
@plantfansam plantfansam mentioned this pull request Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants