go/printer: AST rewriting and then formatting results in mangled docs #11775
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
In golang.org/cl/12373, I wrote a cmd/fix rule to rewrite "types.Typ[x]" into "x.Basic()". However, the naive approach causes
to get formatted as
I.e., the godoc for g is moved up into the arguments section for the .Basic() invocation.
See http://play.golang.org/p/dwq4E8dsMW for a working example.Edit: See http://play.golang.org/p/CP8ylmNjmQ for an updated working example using ast.CommentMap.As a workaround, I found setting Rparen seems to prevent the issue. I wouldn't expect that to be necessary though.
The text was updated successfully, but these errors were encountered: