Skip to content

testing: leading spaces in Example output are dropped from godoc display #4487

@rsc

Description

@rsc
If you write an example that generates a right-leaning triangle:

// Output:
//   *
//  **
// ***

Then it tests okay (I think the leading space is dropped from the target and the actual
output)
but it formats in the web godoc as:

*
 **
***

instead of

  *
 **
***

That is, godoc eats the leading spaces.

More generally I wonder if the comment processing in examples should be handed off to
the standard go/doc comment processing and formatting. It already handles stripping an
*equal* amount of indent from pre blocks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeSuggestedIssues that may be good for new contributors looking for work to do.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions