Open renbou opened 4 months ago
Seems like this is happening specifically with the assignment :=
operator
This is also getting triggered JUST when the error is named err
According to the docs:
foo, err := processFoo()
if err != nil {
return err
}
Will be always formatted to:
foo, err := processFoo()
if err != nil {
return err
}
whether there is a comment or no I suppose
This is working as intended; see "No empty lines before a simple error check" in the README.
Well, maybe this can be changed for the case with comments? I understand that it's working as intended right now, but is there some huge problem with changing it? I could probably make a PR for the change
Personally I don't see the problem with removing empty lines when there are comments, but sure, I can review a PR.
I think this seems fine personally. The comment could be placed inside the block instead. On a simple error check, are you likely to be commenting something useful inbetween those lines too?
Why has gofumpt started removing newlines when it isn't needed? e.g. this is a transformation I'm constantly seeing now
Before formatting:![image](https://github.com/mvdan/gofumpt/assets/30644072/f8ade87f-af6e-4b2f-a6ee-77872eff53b6)
After formatting:![image](https://github.com/mvdan/gofumpt/assets/30644072/7347c65b-3635-41b4-b3a8-b3cbcbbab523)
This just looks incredibly bad, to be honest...