go/format: leading spaces aren't inserted for comments on first pass #63642
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
What version of Go are you using (
go version
)?go1.21 (discovered on tip)
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?Whatever play.go.dev is using.
What did you do?
https://go.dev/play/p/b4foaIeTooZ
What did you expect to see?
I expected no diff between formatting the file once and formatting the input twice.
What did you see instead?
The first formatting removed the identation but does not add a space between
//
andsome comment
.The second formatting adds a space between
//
andsome comment
.As far as I can tell go/format.Source only adds spaces between
//
and the comment text if these comment is not indented.The text was updated successfully, but these errors were encountered: