gocondense is a command-line formatter that reduces vertical noise in Go source code. It moves eligible multi-line constructs onto fewer lines when they fit within a configurable width, while preserving comments and keeping transformations idempotent.
The formatter combines layout changes with selected syntax simplifications. It can process files, directories, recursive directory targets, or source supplied through standard input. It is also usable as a Go library, making the same formatting behaviour available to other tools.
This is free and open source software.
Key Features
- Condenses function signatures, parameters, results, and type parameters.
- Compacts eligible function calls and composite literals.
- Condenses binary expressions, selector chains, and generic instantiations.
- Unwraps single-item declaration groups when comments permit.
- Groups adjacent parameters and results sharing the same type.
- Removes redundant parentheses while preserving operator precedence.
- Trims unnecessary blank lines inside delimited constructs.
- Collapses empty function bodies, structs, and interfaces.
- Removes redundant element types from composite literals.
- Simplifies eligible slice expressions and range statements.
- Removes unnecessary blank identifiers from range statements.
- Supports configurable maximum line length and tab width.
- Provides editor integration and a reusable Go API.
Website: github.com/abemedia/gocondense
Support:
Developer: Adam Bouqdib
License: MIT License
gocondense 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.