-
Notifications
You must be signed in to change notification settings - Fork 18k
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
fmt: clarify when %#q does not use backquotes #4858
Labels
Milestone
Comments
I think that would be surprising and would probably break the Go 1 API promise, in a way. %q is often used in tests to show failures, showing empty strings or strings with accidental binary data. I wouldn't like to see `` vs "" flipping back and forth, depending on other binary data or chars needs to be escaped, or \r, etc. Having one way seems best, even if not ideal. Status changed to WorkingAsIntended. |
I would argue the documentation is misleading then. It says the following: # alternate format: add leading 0 for octal (%#o), 0x for hex (%#x); 0X for hex (%#X); suppress 0x for %p (%#p); print a raw (backquoted) string if possible for %q (%#q); Clearly, it is possible to print the string with backquotes. |
https://golang.org/cl/7387044 Status changed to Started. |
This issue was closed by revision 4692711. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by proebsting:
The text was updated successfully, but these errors were encountered: