-
-
Notifications
You must be signed in to change notification settings - Fork 360
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
Recommend replacing rx.FindIndex(b) != nil
with rx.Match(b)
#1518
Labels
Comments
dominikh
added
enhancement
and removed
needs-triage
Newly filed issue that needs triage
labels
Apr 12, 2024
dominikh
changed the title
detect and warn on unnecessary regexp compilation
Recommend replacing Apr 12, 2024
rx.FindIndex(b) != nil
with rx.Match(b)
I've retitled the issue to more closely match what I think your intention is. |
Exactly thank you!
…On Thu, Apr 11, 2024 at 19:56 Dominik Honnef ***@***.***> wrote:
I've retitled the issue to more closely match what I think your intention
is.
—
Reply to this email directly, view it on GitHub
<https://urldefense.com/v3/__https://github.com/dominikh/go-tools/issues/1518*issuecomment-2050875005__;Iw!!NCc8flgU!Yl6go6hZF-NhVXzsBJIXRL1AqAqKucHHPLONTtohsSeS9jV2YyXfnOWrfMQnfdbgWYxiBEScECxw-wnwnkTLdmDVX4o$>,
or unsubscribe
<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AW5SL4XSPT3ACXWPKHD4FP3Y45EMXAVCNFSM6AAAAABGDBO7UKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJQHA3TKMBQGU__;!!NCc8flgU!Yl6go6hZF-NhVXzsBJIXRL1AqAqKucHHPLONTtohsSeS9jV2YyXfnOWrfMQnfdbgWYxiBEScECxw-wnwnkTLS3iqSV4$>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was just looking at some code that compiled a regex, and then checked for a match by writing:
This is reducible to
return rx.Match(b)
, which is less wasteful. It would be good to suggest this optimization.The text was updated successfully, but these errors were encountered: