Documentation
¶
Overview ¶
Package trimleftright implements a Go analysis linter that flags calls to strings.TrimLeft or strings.TrimRight with a multi-character string literal cutset, where strings.TrimPrefix or strings.TrimSuffix is almost certainly the intended function.
strings.TrimLeft(s, "foo") does NOT remove the prefix "foo"; it removes any leading rune that appears anywhere in the cutset characters 'f', 'o'. This is a well-known Go gotcha.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Analyzer = &analysis.Analyzer{ Name: "trimleftright", Doc: "reports likely mistaken strings.TrimLeft/TrimRight calls using multi-character alphanumeric literal cutsets", URL: "https://github.com/github/gh-aw/tree/main/pkg/linters/trimleftright", Requires: []*analysis.Analyzer{inspect.Analyzer, nolint.Analyzer, filecheck.Analyzer}, Run: run, }
Analyzer is the trimleftright analysis pass.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.