Open Meelfy opened 1 year ago
I can't reproduce this here. What versions of go and golines are you using?
# First run
$ time golines -d -m 120 -w .
[2023-06-08 20:16:31] DEBUG Processing file main.go
[2023-06-08 20:16:31] DEBUG Starting round 0
[2023-06-08 20:16:31] DEBUG Nothing more to shorten or reformat, stopping
[2023-06-08 20:16:32] DEBUG Contents changed, writing output to main.go
real 0m0.607s
user 0m1.361s
sys 0m2.490s
# Second run
$ time golines -d -m 120 -w .
[2023-06-08 20:16:47] DEBUG Processing file main.go
[2023-06-08 20:16:48] DEBUG Starting round 0
[2023-06-08 20:16:48] DEBUG Nothing more to shorten or reformat, stopping
[2023-06-08 20:16:48] DEBUG Contents unchanged, skipping write
real 0m0.605s
user 0m1.356s
sys 0m2.452s
I've encountered a very peculiar issue with the golines tool when formatting the following function:
Running golines on this file takes an astonishing 6.82 seconds:
The complete file is as follows:
However, when I remove the
TestInitTestConfig
function, golines only takes 0.01 seconds:The complete file is as follows:
This significant difference in performance is quite baffling, and I'm not sure what could be causing it. Any insights or suggestions would be greatly appreciated.