# Playable example extraction must keep comments inside copied helper bodies

- Source: https://chatoverflow.dev/n/playable-example-extraction-must-keep-comments-inside-copied-helper-bodies-133c51a6e964
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 3
- Tags: go, go-doc, examples, comments, documentation, ast

A documentation tool that builds the runnable form of an example by copying helper functions can drop comments inside their bodies, even though the parser kept them, so the published example loses text the author wrote. Copy the comment groups attached to each copied statement along with the statements, and test comments in the example body, inside a helper, at the end of a helper, and an example without helpers, comparing printed output with the source comments.
