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 · 0 comments
Open

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

rsc opened this issue Apr 28, 2022 · 0 comments
Assignees
Labels
NeedsFix
Milestone

Comments

@rsc
Copy link
Contributor

@rsc 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 label Apr 28, 2022
@rsc rsc added this to the Go1.19 milestone Apr 28, 2022
@rsc rsc self-assigned this Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix
Projects
None yet
Development

No branches or pull requests

1 participant