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