You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is yet another case where goimports/imports.Process() produces non gofmt-compatible
output on first try (it becomes okay after goimports runs a second time, so this bug is
not as critical as ones where gofmt/goimports undo each other's changes).
http://play.golang.org/p/yr18m3KyVw
Press Format (with goimports) once.
Note that the comments after "fmt" and "go/ast" are not properly
indented.
This happens because Go source code is manipulated via text to insert newlines (which
happens as a last step, after gofmt-compatible output has already been printed). The 3rd
party Go package becomes a separate import group away from the standard "fmt"
and "go/ast", but the comments are not spaced properly.
Trying to get gofmt-compatible output by manipulating text is an endless source of bugs
similar to this, a category of bugs that would simply not exist if we had the ability to
manipulate(/generate) ASTs in code in a way that's easy and correct. That is something
I'll probably try to work on next; I think it will be very valuable in the long run and
it's a prerequisite for creation of new amazing tools that will make our lives better.
The text was updated successfully, but these errors were encountered:
I don't have immediate plans to solve this one in the short term, only long term plans,
but it will be a while before I try to solve higher priority items first (like issue
5551).
The text was updated successfully, but these errors were encountered: