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
strings: EqualFold is not equivalent to comparing ToLower #52204
Comments
Thanks. I'll follow up on this issue. |
ToLower |
Change https://go.dev/cl/398736 mentions this issue: |
Interesting! It seems like a bug in go staticcheck, which recommends replacing Also, I did write a fuzz test locally and it passed without finding a counter-example. Maybe the default fuzzing limit is too low. Given that this transformation has been incorrectly described in multiple places:
Would it make sense to add a note of caution to the
Doesn't need to be pure text, maybe it can be a runnable example. |
Interestingly enough, this particular example seems to be okay with |
Example where comparison via |
Thanks for the examples. @hopehook Sorry for the incorrect suggestion. |
@ianlancetaylor Thanks Ian for the help. I really underestimated the complexity here. |
@typesanitizer @ainar-g Thanks for the examples. I think you are more professional than me. If there is a good solution that can be implemented, I suggest that you can open another issue, solve it together, and help it become better. |
#52022 added this statement to the doc for
strings.EqualFold
:This program seems to be a counterexample.
(Additionally, it seems like the doc meant to say
ToLower
rather thanTolower
?)The text was updated successfully, but these errors were encountered: