What did you do?
package main
type CommentInBrackets [/*c*/] int
type CommentAfterBrackets [] /*c*/ int
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 that ast.ArrayType only records the position of Lbrack but not of Rbrack.
Running gofmt -r 'a -> a' removes both comments, which surprised me. I expected that ast.CommentMap would record all necessary data to preserve at least the second comment.
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.ArrayTypeonly records the position ofLbrackbut not ofRbrack.Running
gofmt -r 'a -> a'removes both comments, which surprised me. I expected thatast.CommentMapwould record all necessary data to preserve at least the second comment.