godoc formatting of example test

77 views
Skip to first unread message

Scott Pakin

unread,
Jan 3, 2023, 11:53:26 PM1/3/23
to golang-nuts
It seems godoc doesn't honor much formatting when rendering function comments for Example functions.  In particular, it rewraps text that I consider preformatted.  For example,

// This is an example:
//
//    foo
//     bar
//      baz
//
// Why does godoc wrap those lines in examples?
func ExampleHello() {
    Hello()
}


produces:
godoc-formatting.png
I used the same text for the Hello function itself in the above to show what formatting I was hoping to see.

Is this behavior intentional or an oversight?  If the latter, is it something the godoc developers would be willing to fix?

Thanks,
— Scott
Reply all
Reply to author
Forward
0 new messages