Skip to content

Repository files navigation

lesiw.io/linelen

Go Reference CI Release Go Version Discord License

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.

Checks

Lines over the limit

Lines wider than the limit are reported with their measured width. A tab counts four columns by default. Positions where wrapping is the author's layout are exempt: import declarations, and function, method, and interface method signatures. A signature stays on one line or wraps as its author chose, while the body is still checked. Generated files are skipped, since a generated line cannot be reflowed by hand.

Usage

go get -tool lesiw.io/linelen/cmd/linelen
go tool linelen ./... # equivalent to: go tool linelen -len 79 -tab 4 ./...

About

A line length analyzer for Go.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages