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.
Related Software
| Go Code Formatters | |
|---|---|
| goimports-reviser | Sorts and groups imports by standard, third-party and project packages |
| gofumpt | Enforces stricter styling rules for cleaner, consistent source |
| gofmt | Applies standardised indentation, spacing and source layout |
| golines | Breaks lengthy statements into readable, shorter lines |
| goimports | Automatically adds missing imports and removes unused ones |
| gocondense | Combines multiline constructs to reduce unnecessary vertical space |
Read our verdict in the software roundup.
LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more. Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion. Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README. |


Please read our Comment Policy before commenting.