-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
testing: leading spaces in Example output are dropped from godoc display #4487
Labels
Milestone
Comments
This behavior is inherent to the Example parsing in go/doc -- it calls strings.TrimSpace on Output. This seems wrong to me not only for the purposes of displaying the Example but for testing as well. One might well construct a whitespace-sensitive example that doesn't fail as expected; for instance, the following actual outputs are accepted by the right-leaning triangle example output: * ** *** * ** *** The testing documentation isn't explicit about the behavior here. What if the output parsing were changed? Right now, doc.Examples removes all leading/trailing whitespace; what if instead it only removed /^[ ]*\n?/ ? I think that's a more intuitive behavior that works for both the single-line (e.g., '// Output: hi') and multi-line output targets. The trimming of the actual output would have to be adjusted correspondingly. I'm happy to make these changes but wanted some feedback first. |
I'm guessing that rsc intended to assign this to Andrew instead. Owner changed to @adg. |
* Does an issue having an owner imply "don't work on this"? * According to http://swtch.com/~rsc/go11.html, the 'Suggested' label is "suggested for people looking for work" Thanks for the clarification; this is not covered in http://golang.org/doc/contribute.html. |
This is what the docs for (*CommentGroup) Text() in go/ast indicate. "Comment markers (//, /*, and */), the first space of a line comment, and leading and trailing empty lines are removed." Here's an example: http://play.golang.org/p/PWA4tmcnOe |
This is merely the result of some over-aggressive trimming. The fix is simple: https://golang.org/cl/7057048/ Status changed to Started. |
This issue was closed by revision a88bbbb. Status changed to Fixed. |
rsc
added
fixed
Suggested
Issues that may be good for new contributors looking for work to do.
labels
Jan 7, 2013
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
The text was updated successfully, but these errors were encountered: