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

Old benchmark loop should be detected #31

Closed
pierrre opened this issue Sep 22, 2024 · 3 comments · Fixed by #36
Closed

Old benchmark loop should be detected #31

pierrre opened this issue Sep 22, 2024 · 3 comments · Fixed by #36
Labels
bug Something isn't working

Comments

@pierrre
Copy link

pierrre commented Sep 22, 2024

Describe the bug
Benchmark loop using the old syntax for i := 0; i < b.N; i++ should be detected.

To Reproduce
Write a benchmark loop with for i := 0; i < b.N; i++ .

Expected behavior
The linter should suggest to rewrite to for range b.N

Additional context
Related to #13

@pierrre
Copy link
Author

pierrre commented Sep 23, 2024

#13 (comment)

I think the proper solution here is to expose a setting to exclude patterns.

What kind of pattern do you have in mind ?
Do you want to match b.N or the entire line ?

@ckaznocha
Copy link
Owner

I was thinking the whole for statement (sans body) but I'm really not settled one way or another, do you have opinions?

@ckaznocha ckaznocha added the bug Something isn't working label Sep 23, 2024
@pierrre
Copy link
Author

pierrre commented Sep 24, 2024

I was thinking the whole for statement (sans body)

looks good 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants