-
-
Couldn't load subscription status.
- Fork 1
Description
As of late 2024, segmentio/golines has functionally been in maintenance mode and several dependencies appear to be similarly unmaintained.
At some point in Q4 2025, this repository will be archived unless active maintainership can be found within Twilio Segment.
The code will remain available, and the terms of the license will not be changed.
https://github.com/segmentio/golines?tab=readme-ov-file#maintenance
golangci/golines is a fork of segmentio/golines.
The main differences are:
- The project structure: organized into packages, and usable as a library
- New tests system that allows testing all the options
- CLI performance improvements
- Several bugs have been fixed
-wand-lcan be used at the same time
There is no breaking change.
CLI Performance
golangci/golines is about nine to fourteen times faster than segmentio/golines.
On my not recent laptop and with the Kubernetes codebase:
| Time | ||
|---|---|---|
segmentio/golines |
goimports as CLI |
4m45s |
golangci/golines |
goimports as CLI |
23s |
golangci/golines |
"goimports" as lib | 20s |
| Time | ||
|---|---|---|
segmentio/golines |
"gofmt" as lib | 1m40s |
golangci/golines |
gofmt as CLI |
13s |
golangci/golines |
"gofmt" as lib | 11s |
It was not possible to use gofmt as CLI with segmentio/golines.
I analyzed all the open issues and PRs of segmentio/golines.
Issues
| Issue | Title | Type | State | Note |
|---|---|---|---|---|
| segmentio#135 | broken image in readme | bug | already fixed | documentation |
| segmentio#119 | README badges are busted | bug | already fixed | documentation |
| segmentio#110 | line break between /* … */ comments and package statement removed | bug | already fixed | inside dave/dst |
| segmentio#65 | Formatting body of case in switch statement does not work | bug/enhancement | already fixed | function paramaters format |
| segmentio#21 | Flag option –write-output (-w) does nothing | bug | fixed (fork) | command line (-w -l) |
| segmentio#160 | Golines does not write a file on Macos 15.3.1 go version 1.24.0 | bug | fixed (fork) | command line (-w -l) + diff |
| segmentio#150 | Running golines -w * errors when it encounters go.mod |
bug | fixed (fork) | missing filter on .go files |
| segmentio#108 | Tag alignment/width doesn't respect comments | bug | fixed (fork) | struct tags blocks |
| segmentio#109 | Remove tags with the same key | bug | fixed (fork) | struct tags duplicated keys |
| segmentio#37 | Assumption about struct tag keys uniqueness could break code | bug | fixed (fork) | struct tags duplicated keys |
| segmentio#161 | bug: do not format escaped quotes as in default:"[\"a\"]" |
bug | fixed (fork) | struct tags excaped chars |
| segmentio#142 | bug: raw literal with backslashes becomes "unescaped" | bug | fixed (fork) | struct tags excaped chars |
| segmentio#134 | golines may output invalid code when \n is present in a struct tag. | bug | fixed (fork) | struct tags excaped chars |
| segmentio#92 | Backslashes being removed from struct tag | bug | fixed (fork) | struct tags excaped chars |
| segmentio#139 | It doesn't work for "if with a statement" | bug/enhancement | fixed (fork) | ifStmt with Init |
| segmentio#67 | Any plans on adding a --lint flag | enhancement | fixed (fork) | golines as lib |
| segmentio#34 | Plans to provide this utility as a library to be used within other projects | enhancement | fixed (fork) | golines as lib |
| segmentio#155 | golines is very slow when using goimports as a base formatter (in a zsh shell) | performance | fixed (fork) | |
| segmentio#157 | Is there any way to exclude a specific file or specific parts of a file? | question/bug | fixed (fork) | struct tags excaped chars |
| segmentio#168 | If lines longer than 120 and contain plus then put on next lines when 'golines . -w' is issued | enhancement | Duplicate segmentio#104 | string concatenation format |
| segmentio#128 | golines does not shorten index expressions in declarations | bug/enhancement | PR segmentio#129 | function paramaters format |
| segmentio#126 | Long lines in interfaces inside structs are not broken down | enhancement | PR segmentio#130 | function paramaters format |
| segmentio#153 | bug: It constantly breaks formatting in these two exact cases in gorm ... comment |
? | only a screenshot | |
| segmentio#99 | Panic if file is missing package declaration |
bug (upstream) | inside dave/dst |
|
| segmentio#66 | Do not shorten output comments that are in Godoc examples | bug/enhancement | format xxxExample output | |
| segmentio#145 | Should function signature formatting be applied to this? | enhancement | function paramaters format | |
| segmentio#94 | Not shortening long type definitions | enhancement | function paramaters format | |
| segmentio#90 | Do not move all parameters to individual lines | enhancement | function paramaters format | |
| segmentio#74 | Wrap long receivers and return types | enhancement | function paramaters format | |
| segmentio#49 | packing function call lines | enhancement | function paramaters format | |
| segmentio#104 | Wrap math expressions | enhancement | string concatenation format | |
| segmentio#131 | Struct literals are not broken down if there are already line breaks | enhancement | struct fields format | |
| segmentio#159 | Long list of switch/case options: Split to block (not each on new line). | enhancement | switch case format | |
| segmentio#106 | Extremely slow golines formatting for specific function | not reproducible | ||
| segmentio#120 | Sign macOS binaries | proposal | ? | |
| segmentio#164 | Breaking short chained methods | proposal | methods chaining format | |
| segmentio#151 | Add option to ignore lines before indent change | proposal | ||
| segmentio#138 | Use .editorconfig file to set line length | proposal | ||
| segmentio#91 | Improve ignore capabilities | proposal | ||
| segmentio#45 | block section from formatting | proposal | ||
| segmentio#39 | Add support for formatting specific line number(s) | proposal | ||
| segmentio#17 | Split long strings | proposal | ||
| segmentio#124 | Support formatting from stdin so golines can be used directly with VS Code's Go extension | question | stdin | |
| segmentio#162 | gopls setup | question | ||
| segmentio#141 | Is it possible to support passing part of the code through stdin? | question | ||
| segmentio#140 | What is the generate binary for |
question | ||
| segmentio#123 | golines format code that does not need to be shortened | question | ||
| segmentio#115 | Unnecessary addition of import logger when symbol exists within a package. | question | ||
| segmentio#100 | The gofumpt formatter doesn't seem to work as a base formatter | question | ||
| segmentio#93 | golines breaks lines with //nolint | question | ||
| segmentio#83 | go install: cannot install cross-compiled binaries when GOBIN is set | question | ||
| segmentio#25 | keep blank line. | question | ||
| segmentio#48 | Tag alignment issue | question/proposal | one struct tag format | |
| segmentio#125 | shorten comments not workring correctly | question/proposal | ||
| segmentio#98 | Tool does not un-format lines that fit within one line | question/proposal | ||
| segmentio#70 | Unwrap lines when wrapping isn't needed | question/proposal |
Pull Requests
| PR | Title | State | Note |
|---|---|---|---|
| segmentio#105 | Add -jobs option | fixed (fork) | This PR provides ~30 %, but my fork provides more than 900% of improvement |
| segmentio#163 | simplify tests; enable testifylint, usetesting linters | fixed (fork) | |
| segmentio#143 | fix: segmentio#142 raw literal with backslashes becomes "unescaped" | fixed (fork) | |
| segmentio#137 | Fix isGenerated to work with license message at top of files | fixed (fork) | |
| segmentio#132 | Format structs that have line breaks | fixed (fork) | |
| segmentio#88 | refactor: Create shorten package | fixed (fork) | |
| segmentio#95 | Added documentation on enabling through Goland | Documentation | |
| segmentio#89 | Expand filter for --ignore-generated |
IMHO, not the right approach | |
| segmentio#174 | feat: add --compact-function-args flag to control function argument formatting | Interesting but no tests | |
| segmentio#130 | Format long lines in struct definitions | Interesting, but required to check regressions | |
| segmentio#129 | Add handling for index expressions | Interesting, but required to check regressions | |
| segmentio#154 | Update .pre-commit-hooks.yaml | No description, no explanation | |
| segmentio#152 | feat: Add option to ignore lines before indentation change | No tests, no option | |
| segmentio#166 | Support editorconfig | Not sure if this change is a good idea | |
| segmentio#122 | Pre-commit hook: pin goimports and allow customized arguments | One of the changes is obsolete with the fork, the other change doesn't seem useful | |
| segmentio#59 | Reflow long comment lines which don't end with a period | Seems off-topic |