Skip to content

Fix lll (line length limit) lines too long linter errors in go files

License

Notifications You must be signed in to change notification settings

ldemailly/lll-fixer

Repository files navigation

lll-fixer

Fix lll (line length limit) lines too long linter errors in go files

Installation

From source

go install github.com/ldemailly/lll-fixer@latest

Or see the numerous binaries in https://github.com/ldemailly/lll-fixer/releases

Or docker fortio/lll-fixer:latest

Or brew brew install fortio/tap/lll-fixer

(I manage the fortio org and usually put everything there but this one is a bit unrelated so for now it is hosted here in ldemailly yet uses fortio's org for docker and brew)

Example

Test on itself:

$ go run . lll_fixer.go
diff --git a/lll_fixer.go b/lll_fixer.go
index c5edf97..30452c3 100644
--- a/lll_fixer.go
+++ b/lll_fixer.go
@@ -43,7 +43,8 @@ func main() {
        }
 }

-// process modifies the file filename to split long comments at maxlen. making this line longer than 80 characters to test.
+// process modifies the file filename to split long comments at maxlen. making
+// this line longer than 80 characters to test.
 func process(fset *token.FileSet, filename string, maxlen int) string {
        log.Infof("Processing file %q", filename)
        // Parse the Go file