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: gofmt does not format indented comments #53005

Closed
ayushr2 opened this issue May 19, 2022 · 4 comments
Closed

cmd/gofmt: gofmt does not format indented comments #53005

ayushr2 opened this issue May 19, 2022 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@ayushr2
Copy link

ayushr2 commented May 19, 2022

$ /tmp/go/bin/go version
go version devel go1.19-668041e Tue May 17 18:55:46 2022 +0000 linux/amd64

gofmt does not format indented comments anymore. Simple reproducer:

$ cat ~/test.go 
package test

//Top level bad comment.
func main() int {
        //Indented bad comment.
}
$ /tmp/go/bin/gofmt ~/test.go 
package test

// Top level bad comment.
func main() int {
	//Indented bad comment.
}
@prattmic prattmic added this to the Go1.19 milestone May 19, 2022
@prattmic prattmic added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 19, 2022
@prattmic
Copy link
Member

cc @rsc

@prattmic
Copy link
Member

I believe this is working as intended.

From the proposal: "We propose that gofmt and go/printer reformat doc comments to a conventional presentation, updating old syntax to new syntax and standardizing details such as the indentation used for preformatted blocks, the exact spacing in lists, and so on."

Your "indented bad comment" is not a doc comment, and thus does not get formatted. That would be another proposal.

Was this a change in behavior? Then it may be a bug. I don't believe we used to do any formatting of comments, but I could be forgetting. Do you have an example of changed behavior?

@mvdan mvdan added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label May 20, 2022
@mvdan
Copy link
Member

mvdan commented May 20, 2022

I agree with @prattmic - I also confirmed that Go 1.18.2's gofmt does not modify either of the two comments.

Removing from the 1.19 milestone, because the regression that the issue reports seems to not be present.

@mvdan mvdan removed this from the Go1.19 milestone May 20, 2022
@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Jun 12, 2022
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@golang golang locked and limited conversation to collaborators Jul 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants