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

Add perfsprint linter #7334

Merged
merged 1 commit into from
Jan 31, 2025
Merged

Conversation

anderseknert
Copy link
Member

And update code to conform to the rule.

  • Replace unnecessary fmt.Sprintf with string concatenation
  • Replace fmt.Sprint with more efficient strconv.Itoa
  • Replace static fmt.Errorf calls with more efficient errors.New

Thanks @srenatus for pushing me down this rabbit hole.
The joke's on you now that you have to review this!

And update code to conform to the rule.

- Replace unnecessary fmt.Sprintf with string concatenation
- Replace fmt.Sprint with more efficient strconv.Itoa
- Replace static fmt.Errorf calls with more efficient errors.New

Thanks @srenatus for pushing me down this rabbit hole!

Signed-off-by: Anders Eknert <[email protected]>
Copy link

netlify bot commented Jan 31, 2025

Deploy Preview for openpolicyagent ready!

Name Link
🔨 Latest commit 817bcbf
🔍 Latest deploy log https://app.netlify.com/sites/openpolicyagent/deploys/679cded4903eef0008cd2676
😎 Deploy Preview https://deploy-preview-7334--openpolicyagent.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@srenatus
Copy link
Contributor

Thanks @srenatus for pushing me down this rabbit hole.
The joke's on you now that you have to review this!

right hand approve pull request, left hand shrug shoulder

Copy link
Contributor

@srenatus srenatus left a comment

Choose a reason for hiding this comment

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

Fine.

@@ -1745,7 +1745,7 @@ func (e *evalResolver) Resolve(ref ast.Ref) (ast.Value, error) {
return merged, err
}
e.e.instr.stopTimer(evalOpResolve)
return nil, fmt.Errorf("illegal ref")
return nil, errors.New("illegal ref")
Copy link
Contributor

Choose a reason for hiding this comment

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

💭 well that's a lot, I might have only applied it to topdown/eval.go where it really matters. Oh let's see what it did to eval.go

....

😆

@anderseknert anderseknert merged commit 55e87e7 into open-policy-agent:main Jan 31, 2025
28 checks passed
@anderseknert anderseknert deleted the perfsprint branch January 31, 2025 19:24
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