Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

golines will probably be archived in the coming months#6091

Unanswered
ldez asked this question inGeneral
Discussion options

ldez
Sep 19, 2025
Maintainer

golines will probably be archived in the coming months (it's written in thereadme).

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.

Based on the text inside the readme, I think they don't want to transfer it.

So I started working on a fork that's more complete than the one we currently use.
I used it to refactor the code, set up more complete tests, and fix some bugs.

https://github.com/golangci/golines/tree/wip/main

I'm still working on the branch (and I push force it), but the overall state is stable and without breaking changes.

I'll open an issue on the original repo for discussion with Segment, but I'll wait a bit in Q4.

You must be logged in to vote

Replies: 3 comments 1 reply

Comment options

ldez
Sep 20, 2025
Maintainer Author

I'm still working on it, but I think I've made good progress.

Still, nothing is breaking.

My primary goal is to enhance the project's maintainability, as this type of project can be challenging to maintain.

Project Structure

I reorganized the project into packages.
First, because we need it for golangci-lint.
Second, because it will be easier to maintain.

I replacedlogrus withslog (the logger is only used for debugging).

I still haven't decided if I will convert theshortener package to a module (to avoid some dependencies when using it as a lib)

Tests

I added a new test system that allows testing all theShortener options.
And so I added more tests.

I also added more tests on each structure, function, etc.

CLI Performance

I improved the performance of the CLI significantly by using the same design asgo fmt, and some optimizations.

My fork is about nine to fourteen times faster than the current golines.

Note: I don't have a recent laptop (~4 years old).

On the Kubernetes codebase:

Time
currentgoimports as CLI4m45s
forkgoimports as CLI23s
fork"goimports" as lib20s
Time
current"gofmt" as lib1m40s
forkgofmt as CLI13s
fork"gofmt" as lib11s

It is not possible to usegofmt as CLI with the current official version.

Skip cases

I added more skip cases (testdata, dot directories, etc), basically the same thing asgolangci-lint fmt.

Bugs

I fixed some bugs:

  • wrong directive pattern
  • struct tag literals
  • etc.

Notes

The default base formatter (goimports) didn't provide a good experience by default.
It was four times slower thangofmt.

You must be logged in to vote
0 replies
Comment options

ldez
Oct 1, 2025
Maintainer Author

I analyzed all the open issues and PRs of golines.

Issues
IssueTitleTypeStateNote
segmentio/golines#135broken image in readmebugalready fixeddocumentation
segmentio/golines#119README badges are bustedbugalready fixeddocumentation
segmentio/golines#110line break between /* … */ comments and package statement removedbugalready fixedinsidedave/dst
segmentio/golines#65Formatting body of case in switch statement does not workbug/enhancementalready fixedfunction paramaters format
segmentio/golines#161bug: do not format escaped quotes as indefault:"[\"a\"]"bugfixed (fork)struct tags excaped chars
segmentio/golines#160Golines does not write a file on Macos 15.3.1 go version 1.24.0bugfixed (fork)command line (-w -l) + diff
segmentio/golines#150Runninggolines -w * errors when it encounters go.modbugfixed (fork)missing filter on.go files
segmentio/golines#142bug: raw literal with backslashes becomes "unescaped"bugfixed (fork)struct tags excaped chars
segmentio/golines#134golines may output invalid code when \n is present in a struct tag.bugfixed (fork)struct tags excaped chars
segmentio/golines#109Remove tags with the same keybugfixed (fork)struct tags duplicated keys
segmentio/golines#108Tag alignment/width doesn't respect commentsbugfixed (fork)struct tags blocks
segmentio/golines#92Backslashes being removed from struct tagbugfixed (fork)struct tags excaped chars
segmentio/golines#37Assumption about struct tag keys uniqueness could break codebugfixed (fork)struct tags duplicated keys
segmentio/golines#21Flag option –write-output (-w) does nothingbugfixed (fork)command line (-w -l)
segmentio/golines#139It doesn't work for "if with a statement"bug/enhancementfixed (fork)ifStmt with Init
segmentio/golines#67Any plans on adding a --lint flagenhancementfixed (fork)golines as lib
segmentio/golines#34Plans to provide this utility as a library to be used within other projectsenhancementfixed (fork)golines as lib
segmentio/golines#155golines is very slow when using goimports as a base formatter (in a zsh shell)performancefixed (fork)
segmentio/golines#157Is there any way to exclude a specific file or specific parts of a file?question/bugfixed (fork)struct tags excaped chars
segmentio/golines#128golines does not shorten index expressions in declarationsbug/enhancementPRfunction paramaters format
segmentio/golines#153bug: It constantly breaks formatting in these two exact cases ingorm ... comment?only a screenshot
segmentio/golines#99Panic if file is missingpackage declarationbug (upstream)insidedave/dst
segmentio/golines#66Do not shorten output comments that are in Godoc examplesbug/enhancementformat xxxExample output
segmentio/golines#168If lines longer than 120 and contain plus then put on next lines when 'golines . -w' is issuedenhancementstring concatenation format
segmentio/golines#159Long list of switch/case options: Split to block (not each on new line).enhancementswitch case format
segmentio/golines#145Should function signature formatting be applied to this?enhancementfunction paramaters format
segmentio/golines#131Struct literals are not broken down if there are already line breaksenhancementstruct fields format
segmentio/golines#126Long lines in interfaces inside structs are not broken downenhancementfunction paramaters format
segmentio/golines#104Wrap math expressionsenhancementstring concatenation format
segmentio/golines#94Not shortening long type definitionsenhancementfunction paramaters format
segmentio/golines#90Do not move all parameters to individual linesenhancementfunction paramaters format
segmentio/golines#74Wrap long receivers and return typesenhancementfunction paramaters format
segmentio/golines#49packing function call linesenhancementfunction paramaters format
segmentio/golines#106Extremely slow golines formatting for specific functionnot reproducible
segmentio/golines#120Sign macOS binariesproposal?
segmentio/golines#164Breaking short chained methodsproposalmethods chaining format
segmentio/golines#151Add option to ignore lines before indent changeproposal
segmentio/golines#138Use .editorconfig file to set line lengthproposal
segmentio/golines#91Improve ignore capabilitiesproposal
segmentio/golines#45block section from formattingproposal
segmentio/golines#39Add support for formatting specific line number(s)proposal
segmentio/golines#17Split long stringsproposal
segmentio/golines#162gopls setupquestion
segmentio/golines#141Is it possible to support passing part of the code through stdin?question
segmentio/golines#140What is thegenerate binary forquestion
segmentio/golines#124Support formatting from stdin so golines can be used directly with VS Code's Go extensionquestionstdin
segmentio/golines#123golines format code that does not need to be shortenedquestion
segmentio/golines#115Unnecessary addition of import logger when symbol exists within a package.question
segmentio/golines#100The gofumpt formatter doesn't seem to work as a base formatterquestion
segmentio/golines#93golines breaks lines with //nolintquestion
segmentio/golines#83go install: cannot install cross-compiled binaries when GOBIN is setquestion
segmentio/golines#25keep blank line.question
segmentio/golines#125shorten comments not workring correctlyquestion/proposal
segmentio/golines#98Tool does not un-format lines that fit within one linequestion/proposal
segmentio/golines#70Unwrap lines when wrapping isn't neededquestion/proposal
segmentio/golines#48Tag alignment issuequestion/proposalone struct tag format

I fixed all the bugs inside the fork.

Pull Requests
PRTitleStateNote
segmentio/golines#105Add -jobs optionfixed (fork)This PR provides ~30 %, but my fork provides more than 900% of improvement
segmentio/golines#163simplify tests; enable testifylint, usetesting lintersfixed (fork)
segmentio/golines#143fix:#142 raw literal with backslashes becomes "unescaped"fixed (fork)
segmentio/golines#137Fix isGenerated to work with license message at top of filesfixed (fork)
segmentio/golines#132Format structs that have line breaksfixed (fork)
segmentio/golines#88refactor: Create shorten packagefixed (fork)
segmentio/golines#95Added documentation on enabling through GolandDocumentation
segmentio/golines#89Expand filter for--ignore-generatedIMHO, not the right approach
segmentio/golines#174feat: add --compact-function-args flag to control function argument formattingInteresting but no tests
segmentio/golines#130Format long lines in struct definitionsInteresting, but required to check regressions
segmentio/golines#129Add handling for index expressionsInteresting, but required to check regressions
segmentio/golines#154Update .pre-commit-hooks.yamlNo description, no explanation
segmentio/golines#152feat: Add option to ignore lines before indentation changeNo tests, no option
segmentio/golines#166Support editorconfigNot sure if this change is a good idea
segmentio/golines#122Pre-commit hook: pin goimports and allow customized argumentsOne of the changes is obsolete with the fork, the other change doesn't seem useful
segmentio/golines#59Reflow long comment lines which don't end with a periodSeem offtopic
You must be logged in to vote
0 replies
Comment options

ldez
Oct 6, 2025
Maintainer Author

I'm thinking about how to proceed.

I think I will:

  1. create a branchmain based on the currentmaster branch of the Segment repo.
  2. switch the default branch of the fork tomain (instead offork as currently)
  3. open a PR with all my changes and merge it. Not to be reviewed, but for history.
  4. open an issue in the Segment repo.
  5. wait for feedback from Segment before creating a tag
You must be logged in to vote
1 reply
@ldez
Comment options

ldezOct 7, 2025
Maintainer Author

segmentio/golines#175

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
General
Labels
None yet
1 participant
@ldez

[8]ページ先頭

©2009-2025 Movatter.jp