Skip to content

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

@rsc

Description

@rsc

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
}
%

Metadata

Metadata

Assignees

Labels

FixPendingIssues that have a fix which has not yet been reviewed or submitted.NeedsFixThe path to resolution is known, but the work has not been done.

Type

No type

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions