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

cmd/gofmt: smart quotes are not #61365

Closed
seebs opened this issue Jul 14, 2023 · 1 comment
Closed

cmd/gofmt: smart quotes are not #61365

seebs opened this issue Jul 14, 2023 · 1 comment

Comments

@seebs
Copy link
Contributor

seebs commented Jul 14, 2023

What version of Go are you using (go version)?

$ go version
1.20.5

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

N/A

What did you do?

Tried to document an SQL parser.

What did you expect to see?

The comments I wrote. Specifically, for instance:

// but SQL uses doubled quotes, instead of backslashes, to escape things,
// so for instance, the string literal `'foo''bar'` denotes the string `foo'bar`.

What did you see instead?

Different comments which were wrong, specifically:

// but SQL uses doubled quotes, instead of backslashes, to escape things,
// so for instance, the string literal `'foo”bar'` denotes the string `foo'bar`.

That's not what I wrote, and it's not true.

What should be done

gofmt should absolutely, positively, under NO CIRCUMSTANCES WHATSOEVER replace meaningful and correct content in comments with completely incorrect content in comments. Smart quotes are NOT a correct replacement for apostrophes, least of all in documentation.

Honestly it should just absolutely never under any circumstances happen, but the fact that we're here at all means someone is deeply committed to it happening. But it should, very very much, absolutely be POSSIBLE TO SUPPRESS IT. For instance, by wrapping the quoted text in backticks to indicate that it's especially important that it be interpreted completely literally and not altered in any way.

gofmt is one of the best things about using Go because everyone can/does use it. that is contingent, in part, on it having a very light hand and not destroying things. Minor tweaks like adjusting spacing are pretty survivable. But if the result of using the tool is that my file is corrupted and my documentation is wrong, I'll stop using the tool, and if a lot of people stop using it, we lose one of the nicest things about the practical daily life of a person trying to work in Go.

@seankhliao
Copy link
Member

Duplicate of #54312

@seankhliao seankhliao marked this as a duplicate of #54312 Jul 14, 2023
@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants