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.
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.
go get -tool lesiw.io/linelen/cmd/linelen
go tool linelen ./... # equivalent to: go tool linelen -len 79 -tab 4 ./...