golines is a command-line formatter for Go that focuses on shortening source lines that exceed a chosen width. It works with Go syntax rather than treating source as plain text, adjusting line breaks around suitable constructs before passing the result through a base formatter.
The formatter is intended for developers who want automated control over line length while retaining conventional Go formatting. It can process files, directories, or standard input and can either print results, show changes, or update source files directly.
This is free and open source software.
Key Features
- Shortens Go source lines beyond a configurable maximum width.
- Lets users configure the tab width used in length calculations.
- Handles individual files, directories, and standard input.
- Can update source files in place.
- Provides a dry-run mode with Git-style diffs.
- Uses goimports as its preferred base formatter when available.
- Falls back to gofmt when goimports is unavailable.
- Allows an alternative base formatter to be selected explicitly.
- Skips generated files by default.
- Can optionally shorten single-line comments.
- Supports alternative splitting of chained method calls.
- Can reformat struct tag alignment when that option is enabled.
Website: github.com/golangci/golines
Support:
Developer: Golangci Team
License: MIT License
golines is written in Go. Learn Go with our recommended free books and free tutorials.
Explore our carefully curated directory of recommended free and open source software, covering every major software category.The directory forms part of our extensive collection of articles for Linux enthusiasts. It includes hundreds of detailed reviews, together with free and open source alternatives to proprietary software from companies such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. LinuxLinks also covers interesting projects worth exploring, Linux-compatible hardware, free programming books and tutorials, and much more. Know a useful free and open source Linux application that we haven’t covered? Tell us about it using our submission form. |


Please read our Comment Policy before commenting.