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: pragmas treated differently than in cmd/compile #22022
What version of Go are you using (
For what it's worth, I'm not a fan of how lax cmd/compile is in parsing pragmas, and I think it is unfortunate that it makes support in go/ast-based tooling more difficult. I'd be supportive of refining where it's valid to write pragmas. (So far, we've strived for strict backwards compatibility when reworking the lexer/parser.)
I think some formal standard for pragmas would avoid such bugs in future. I see two main types of pragmas.
If position sensitive pragmas are always placed directly before associated code, then it's easier for AST tools to preserve their relative-positions. Without that, AST tools may end up misplacing them (#17315).
Can we standardize along those lines?