Skip to content

duplicate-trim-cutset

Default severity: warning

strings.Trim, TrimLeft, and TrimRight interpret their second argument as a set of runes, not as a prefix or suffix. Duplicate runes have no effect and often reveal that TrimPrefix or TrimSuffix was intended.

strings.TrimLeft(value, "letter")
strings.TrimPrefix(value, "prefix")