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

staticcheck: recommend iterator-based alternatives from the standard library #1432

Open
dominikh opened this issue Aug 10, 2023 · 0 comments

Comments

@dominikh
Copy link
Owner

If the various iterator-related Go proposals (such as golang/go#61901) get accepted, then code like for a, b := range strings.Fields(...) would be more efficient if it used iterator-based alternatives instead, because they wouldn't have to allocate slices.

This new check would very likely have to be opt-in. We don't want to start flagging 10 years of existing and previously correct code by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant