gobyexample
gobyexample copied to clipboard
Adding printouts to make code easier to correlate to output
This is a "catch-all" issue to discuss adding printout prefixes in some examples to make the code easier to correlate to output.
gobyexample has a number of examples that produce many printouts, and it's sometimes difficult to correlate them to the output pane at the bottom (which printout produced which output?)
Some issues and PRs were raised over time to address this, but it isn't a trivial problem to solve. Fixes like #391 worked out well because the specific example has short lines in printouts, and adding the prefixes aligned well with the existing Printf
calls. Other examples, like #288 are much trickier because we're limited by line length and the regex example is already pushing the maximal line length in many cases, with no prefixes.
Generally it's a tradeoff between code readability and the correlation of output to printouts. We could add a separate fmt.Println("prefix:")
before each example, but this would inflate the code side and make the examples generally harder to read.
will pull request be considered for this enhancement ?
Yes, but on a case-by-case basis for specific examples