Skip to content

Conversation

@anderseknert
Copy link
Member

Have done this some time before, but there were a few new issues this would highlight now that we're on Go 1.24.

Mostly:

  • Use b.Loop() in benchmarks
  • Use strings.SplitSeq where possible
  • Remove omitempty tag for types that can't be empty

Have done this some time in the past, but there was a few
new issues this would highlight now that we're on Go 1.24.

Mostly:
- Use `b.Loop()` in benchmarks
- Use `strings.SplitSeq` where possible
- Remove `omitempty` tag for types that can't be empty

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

netlify bot commented Oct 6, 2025

Deploy Preview for openpolicyagent ready!

Name Link
🔨 Latest commit ec73058
🔍 Latest deploy log https://app.netlify.com/projects/openpolicyagent/deploys/68e8ffa2dba6f1000818ac8c
😎 Deploy Preview https://deploy-preview-7965--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 project configuration.

Copy link
Member

@philipaconrad philipaconrad left a comment

Choose a reason for hiding this comment

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

After reading through the changes, this PR is exactly what it claims to be: a lot of small, repetitive modernization changes to bring our testing/benchmarking code in line with the tools available in modern Golang. (b.Loop, string splitting iterators, etc.)

Thanks for trawling through the testing and benchmarking code for this PR @anderseknert!

a := header.Get("Accept-Encoding")
parts := strings.Split(a, ",")
for _, part := range parts {
for part := range strings.SplitSeq(header.Get("Accept-Encoding"), ",") {
Copy link
Member

Choose a reason for hiding this comment

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

I like how much the iterator cleans things up here. 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes! 😍

@anderseknert anderseknert merged commit d3f34a3 into open-policy-agent:main Oct 10, 2025
31 checks passed
@anderseknert anderseknert deleted the modernize branch October 10, 2025 15:51
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