Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding printouts to make code easier to correlate to output #394

Open
eliben opened this issue Sep 10, 2021 · 2 comments
Open

Adding printouts to make code easier to correlate to output #394

eliben opened this issue Sep 10, 2021 · 2 comments

Comments

@eliben
Copy link
Collaborator

eliben commented Sep 10, 2021

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.

eliben added a commit that referenced this issue Sep 10, 2021
See #394 for details.

This closes #288 by providing a lighter-weight approach.
@jaiswalpuru
Copy link

will pull request be considered for this enhancement ?

@eliben
Copy link
Collaborator Author

eliben commented Jun 23, 2023

Yes, but on a case-by-case basis for specific examples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants