-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Description
Proposal Details
This happened to me yesterday:
% gofmt char.go > x
% diff char.go x
82c82
< // Raw quotes are Go-like and bounded by ``.
---
> // Raw quotes are Go-like and bounded by “.
In the font I was using, those lines were pixel-identical. I was very confused and it took me a while to figure out what was going on.
I was surprised to see smart quotes placed in my source code without my explicitly typing them. I see that this came about as part of proposal #51082. The design doc mentions this change, but without explicit justification.
I have several objections to this. One is the mystery of my experience, but leave that aside.
This change means that gofmt will now rewrite my comments to include things I cannot easily type. It will of course do rewriting in general, but this is the first time I can think of that the resulting text contains characters (other than spacing changes) that are not in the original, let alone ones that are not on the keyboard.
Also, these are programmatic characters. If the comment contains an example that uses these characters, as mine did, the snippet is no longer valid.
It also means that If I choose to search for, say
``
because I know it's there, it won't be there any more.
I have a suggestion. I'd like to see this particular detail rolled back completely, but given a certain love for fancy formatting by some people, I suggest smart quotes be added only for go doc, and never for go fmt.
In summary: Do not put smart quotes in my Go source files behind my back.