You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the introduction of strings.CutPrefix and strings.CutSuffix I've started noticing code that should use strings.TrimPrefix/strings.TrimSuffix instead:
x, _ := strings.CutPrefix(y, "abc")
I just implemented the trivial analyzer for this for our internal lint tool. Might be a nice (tiny) addition to staticcheck.
The text was updated successfully, but these errors were encountered:
Since the introduction of
strings.CutPrefix
andstrings.CutSuffix
I've started noticing code that should usestrings.TrimPrefix
/strings.TrimSuffix
instead:I just implemented the trivial analyzer for this for our internal lint tool. Might be a nice (tiny) addition to staticcheck.
The text was updated successfully, but these errors were encountered: