You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was investigating yesterday why golines was so slow on our projects and I noticed that switching to gofmt as a base formatter makes it massively faster, by about two orders of magnitude.
With gofmt:
golines -w --base-formatter="gofmt" **/*.go 0.05s user 0.02s system 74% cpu 0.090 total
With goimports:
golines -w --base-formatter="goimports" **/*.go 54.97s user 313.56s system 822% cpu 44.821 total
I unfortunately can't share the code as an example, but I do reproduce those results by running golines on https://github.com/rs/zerolog, using commit 6abadab
The difference is less staggering on zerolog, but still very much present, about 0.2s vs 16.4s.
Strangely enough, if I run golines with goimports, but from bash shell, the time goes down to about the same level than when using gofmt.
I'm using go v1.23.3 and golines@13c3f0d
abraithwaite, craig-cogdill, carlmontanari, lindsaygrace and bernardolm