Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/gofmt new, bad behavior, removes pre-function whitespace readability comment line in 1.19.3 #57388

Closed
glycerine opened this issue Dec 18, 2022 · 1 comment

Comments

@glycerine
Copy link

go version go1.19.3 linux/amd64

For the first time I find myself fighting with gofmt, in go version 1.19.3, because there is new, undesirable behavior.

gofmt will now delete my comment lines that I have placed between the func documentation and the actual func
to provide readability improvement by having some whitespace between the comment and the func line.

Please revert to the long established traditional behavior of gofmt that preserved those otherwise empty
comment lines.

example:

// MyFunc description here, with a following whitespace line to separate dense text.
//
func MyFunc(a, b, c, d string, int etc) {

gofmt used to leave this, quite properly, alone. But now it removes that line with only //, leaving:

// MyFunc description here, with a following whitespace line to separate dense text.
func MyFunc(a, b, c, d string, int etc)  {

which causes my eyes to bug-out when trying to read the function description. I will try
to put the comment back in, but gofmt in 1.19.3 always, nastily, removes it again. I will
revert to an earlier gofmt until this is repaired.

This also has the undesirable side effect of causing alot of capricious comment code changes when gofmt
is run on large directories of go code, causing spurious source code control changes.

@seankhliao
Copy link
Member

Duplicate of #54489

@seankhliao seankhliao marked this as a duplicate of #54489 Dec 18, 2022
@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Dec 18, 2022
@golang golang locked and limited conversation to collaborators Dec 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants