cmd/gofmt: -r strips some comments in array types #57680
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What did you do?
Running
gofmt -r 'any -> any'
moves the first comment out of the brackets, which may be surprising to a user but understandable once you know thatast.ArrayType
only records the position ofLbrack
but not ofRbrack
.Running
gofmt -r 'a -> a'
removes both comments, which surprised me. I expected thatast.CommentMap
would record all necessary data to preserve at least the second comment.The text was updated successfully, but these errors were encountered: