• Daniel Martí's avatar
    go/printer: indent lone comments in composite lits · a265f2e9
    Daniel Martí authored
    If a composite literal contains any comments on their own lines without
    any elements, the printer would unindent the comments.
    
    The comments in this edge case are written when the closing '}' is
    written. Indent and outdent first so that the indentation is
    interspersed before the comment is written.
    
    Also note that the go/printer golden tests don't show the exact same
    behaviour that gofmt does. Added a TODO to figure this out in a separate
    CL.
    
    While at it, ensure that the tree conforms to gofmt. The changes are
    unrelated to this indentation fix, however.
    
    Fixes #22355.
    
    Change-Id: I5ac25ac6de95a236f1e123479127cc4dd71e93fe
    Reviewed-on: https://go-review.googlesource.com/74232
    Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
    Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
    a265f2e9
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...