Skip to content

go/printer: incorrect formatting of empty comments #53059

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

Closed
findleyr opened this issue May 24, 2022 · 2 comments
Closed

go/printer: incorrect formatting of empty comments #53059

findleyr opened this issue May 24, 2022 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@findleyr
Copy link
Member

findleyr commented May 24, 2022

At tip (but not 1.18.2), go/printer incorrectly removes the blank line between A and B here:

func A() {
}

//
func B() {
}

resulting in

func A() {
}
func B() {
}

https://go.dev/play/p/VTb8TuGHV2U?v=gotip

@findleyr findleyr added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker labels May 24, 2022
@findleyr findleyr added this to the Go1.19 milestone May 24, 2022
@findleyr
Copy link
Member Author

Bisected to https://go.dev/cl/384264

CC @rsc @jba

@findleyr findleyr changed the title go/format: incorrect formatting of empty comments go/printer: incorrect formatting of empty comments May 24, 2022
@ianlancetaylor ianlancetaylor self-assigned this May 25, 2022
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/408394 mentions this issue: go/printer: if comment gets formatted away, don't squash

@golang golang locked and limited conversation to collaborators Jun 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants