mvdan / gofumpt

A stricter gofmt
https://pkg.go.dev/mvdan.cc/gofumpt
BSD 3-Clause "New" or "Revised" License
3.28k stars 113 forks source link

#284 unconditionally remove leading and trailing lines from code blocks #286

Open davidmdm opened 12 months ago

davidmdm commented 12 months ago

This implements as far as I can tell, the change needed for this issue.

Unclear as to how where tests live at this time, but running go test ./... seems to still be working.

davidmdm commented 11 months ago

@mvdan Can you take a look at this?

flan6 commented 8 months ago

ive been using this pr for a while on some projects and it indeed works. =) Thanks @davidmdm

davidmdm commented 8 months ago

@flan6 I would love this to be merged so that we can get it integrated into gopls. I have to build my own branch of gopls to get the automatic formatting behavior that I want :(

flan6 commented 6 months ago

@davidmdm hi! have you seen what @mvdan said about this pr on issue #284? I'm not sure if you should do it or me ._.

davidmdm commented 6 months ago

Hi @flan6,

I saw it, however I don't have the bandwidth personally to figure out how to do the look ahead to figure out if the block precedes an if-else or else block.

Also, personally, I prefer the current behaviour where all blocks are pruned of newlines.

These things combined mean that I haven't had the time or motivation to address @mvdan's review.

If you're able to carry it through that would be great. Otherwise I'll try and get to it eventually but it won't necessarily be in the next month or so.

flan6 commented 6 months ago

Also, personally, I prefer the current behaviour where all blocks are pruned of newlines.

I see, and I agree with you about the rule. But nonetheless it is a great improvement over what it was before. And I am very grateful for your effort so far! I'll try to carry it on and achieve what mdvan requested and i will surely let you know about the outcome!

Again, thank you so much