Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
cmd/cover: mishandles go: comments #10378
Running with current tip.
Reproduce by running (on linux/amd64):
@dvyukov Some comments are attached, some are not. In general, the AST support for comments is not ideal. Comments inside functions are not attached at all. There's complex code in the printer that merges comments and code by comparing position information.
I haven't looked at the specifics of this problem. A generally correct solution (for all comments) is very difficult with the current AST. Maintaining function (and general declaration comments) should be doable. There's also the ast.CommentMap which may work for this problem.
The long-term solution is a new AST where all comments are attached to nodes.