Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. golines

golines

MITGov0.13.0

A Go code formatter that automatically shortens long lines beyond what gofmt provides.

GitHubGitHub
1.1k stars78 forks0 contributors

What is golines?

Golines is a Go code formatter that automatically shortens long lines, which standard Go tools like gofmt deliberately omit. It helps maintain readable code by breaking down excessively long lines according to configurable preferences, such as maximum line length and method chain splitting. Additionally, it performs formatting fixes like struct tag alignment and integrates with base formatters like goimports.

Target Audience

Go developers who prioritize code readability and want automated enforcement of line length limits, particularly those working on large codebases or teams where consistent formatting is crucial. It's also useful for developers who use method chaining or complex structs and need tools to format these constructs cleanly.

Value Proposition

Developers choose Golines because it fills a gap left by standard Go formatting tools by automatically shortening long lines, reducing manual effort and improving code consistency. Its unique selling point is the combination of line shortening with configurable options like method chain splitting and struct tag alignment, offering more control over formatting than gofmt alone.

Overview

A golang formatter that fixes long lines

Use Cases

Best For

  • Automatically shortening long lines in Go code to improve readability and maintain consistency across a codebase.
  • Formatting method chains in Go by splitting them on dots or arguments for cleaner, more organized code.
  • Aligning struct tag keys in Go to enhance code structure and visual consistency.
  • Integrating with developer tools like vim-go, Visual Studio Code, or Goland to enforce formatting on save.
  • Handling generated files in Go projects with configurable options to ignore or format them as needed.
  • Previewing formatting changes safely using dry-run mode to see git-style diffs without modifying files.

Not Ideal For

  • Projects requiring actively maintained dependencies and regular security updates, as the original repository is archived and dependencies are unmaintained.
  • Teams locked on older Go versions (e.g., below 1.18 or 1.23) who need the latest tooling features, since newer golines releases have strict minimum Go version requirements.
  • Developers who prefer minimal, zero-configuration formatting and find the additional setup for IDE integrations or custom flags cumbersome.

Pros & Cons

Pros

Automatic Line Shortening

Fills a key gap left by gofmt by automatically breaking lines exceeding a configurable maximum length (default 100 columns), as highlighted in the motivation section with examples of improved readability.

Struct Tag Alignment

Reformats and aligns struct tag keys for consistency, with before-and-after examples provided in the _fixtures directory, enhancing code structure without manual effort.

Flexible Method Chain Splitting

Offers configurable options to split long method chains on dots or arguments, with the default splitting on dots for cleaner code, as detailed in the chained method splitting section.

Dry-Run Safety

Includes a --dry-run flag that shows git-style diffs without modifying files, allowing developers to preview changes safely before applying them.

Cons

Archived and Unmaintained

The repository was archived in 2025, with the README noting that dependencies are similarly unmaintained, meaning no future bug fixes, security patches, or feature updates from the original maintainers.

Poor Comment Shortening

Comment shortening is described as basic and turned off by default because the quality isn't great, limiting its utility for formatting long comments without manual intervention.

Complex IDE Integration

For some editors like Visual Studio Code, integration requires installing third-party extensions and manual JSON configuration, which is more involved than using built-in formatters.

Frequently Asked Questions

Quick Stats

Stars1,122
Forks78
Contributors0
Open Issues58
Last commit10 months ago
CreatedSince 2019

Tags

#developer-tools#gofmt#code-formatter#automated-formatting#line-length#code-quality#go-tooling#go

Built With

G
Go

Included in

Go169.1k
Auto-fetched 1 day ago

Related Projects

golangci-lintgolangci-lint

Fast linters runner for Go

Stars19,463
Forks1,641
Last commit1 day ago
staticcheckstaticcheck

Staticcheck - The advanced Go linter

Stars6,912
Forks431
Last commit10 days ago
reviverevive

🔥 Fast, strict, configurable, extensible, and beautiful linter for Go

Stars5,554
Forks339
Last commit3 days ago
errcheckerrcheck

errcheck checks that you checked errors.

Stars2,531
Forks152
Last commit12 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub