Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
fmt: clarify when %#q does not use backquotes #4858
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.