go/parser: files parsed with mode 'parser.ImportsOnly|parser.ParseComments' can contain a comment after import declaration #47778
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What did you do?
parser.ImportsOnly|parser.ParseComments
:*ast.File.Comments
The Go Playground link: https://play.golang.org/p/w0yK1K_q4tr
What did you expect to see?
3 comments:
What did you see instead?
4 comments:
"F func\n"
is an extra comment because the documentation forparser.ImportsOnly
saysstop parsing after import declarations
. However, if an import declaration is followed by any code without comments, there will be no extra comments. For example:This bug was originally discovered in #47436 (comment)
The text was updated successfully, but these errors were encountered: