Note
This repository has moved to lesiw.io/tools/analyzers/linelen.
An analysis.Analyzer for line length.
Width is measured in runes after expanding tabs, so a multibyte character counts once and a tab counts as its display width. Carriage returns are stripped before measuring. The defaults — a limit of 79 and a tab width of 4 — are flags.
A line wider than the limit is reported with its measured width. A tab counts four columns by default. A line is not reported when:
- It is an import declaration.
- It is a function, method, or interface method signature. A signature stays on one line or wraps as its author chose, while the body is still measured.
- It is in a generated file.
- One continuous string literal or URL takes up more than half of the line's width, ignoring indentation.
go get -tool lesiw.io/linelen/cmd/linelen
go tool linelen ./... # equivalent to: go tool linelen -len 79 -tab 4 ./...