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

go/printer: false positive for doc comment formatting on unindented input #52605

Open
rsc opened this issue Apr 28, 2022 · 1 comment
Open

go/printer: false positive for doc comment formatting on unindented input #52605

rsc opened this issue Apr 28, 2022 · 1 comment
Assignees
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Apr 28, 2022

The added blank line in the comment shows that go/printer is treating this as a doc comment, even though it's not.
It is being tricked by the lack of indentation, which I used as part of the signal for "top-level comment".
Very minor, but should do better.

% cat /tmp/x.go
package p

type T struct {
// This is not
//	a doc comment.
X int
}
% gofmt /tmp/x.go
package p

type T struct {
	// This is not
	//
	//	a doc comment.
	X int
}
%
@rsc rsc added the NeedsFix The path to resolution is known, but the work has not been done. label Apr 28, 2022
@rsc rsc added this to the Go1.19 milestone Apr 28, 2022
@rsc rsc self-assigned this Apr 28, 2022
@gopherbot gopherbot modified the milestones: Go1.19, Go1.20 Aug 2, 2022
@gopherbot gopherbot modified the milestones: Go1.20, Go1.21 Feb 1, 2023
@gopherbot gopherbot modified the milestones: Go1.21, Go1.22 Aug 8, 2023
@gopherbot gopherbot modified the milestones: Go1.22, Go1.23 Feb 6, 2024
@gopherbot
Copy link

Change https://go.dev/cl/579978 mentions this issue: go/printer: fix false positive doc comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Projects
Status: No status
Development

No branches or pull requests

2 participants