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/go: 'go fmt' shouldn't reformat comments of unexported identifiers #53339

Closed
aarzilli opened this issue Jun 12, 2022 · 2 comments
Closed

Comments

@aarzilli
Copy link
Contributor

Starting in go1.19 go fmt reformats certain comments to conform to the new go/doc syntax (#51082).

The reformatting is always fine for doc comments that conformed to the previous go/doc syntax since it does not alter the way they are rendered.

Doc comments of unexported identifiers are never (?) rendered by either godoc or pkgsite, therefore they should not be reformatted since they might not conform to go/doc syntax.

For example:

// blah blah blah
// - blah blah blah
//   blah blah
// blah blah blah

reformats to:

// blah blah blah
// - blah` blah blah
//
// 	blah blah
//
// blah blah blah
@robpike
Copy link
Contributor

robpike commented Jun 12, 2022

If you run

go doc -u

('u' for unexported) the comments are shown. The behavior is working as intended.

@aarzilli
Copy link
Contributor Author

Fair enough, in that case I will close this issue. Still, it seems risky.

@golang golang locked and limited conversation to collaborators Jun 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants