trimleftright

package
v0.85.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 10 Imported by: 0

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 = analyzerutil.New("trimleftright", "reports likely mistaken strings.TrimLeft/TrimRight calls using multi-character alphanumeric literal cutsets", run)

Analyzer is the trimleftright analysis pass.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL