On Sat, Feb 14, 2015 at 8:03 AM, Florin Patan <
flori...@gmail.com> wrote:
>
> I'm sorry if I'm not grasping the full extent of the issue, but like you've
> said, you are using it by default and it's included in the official
> playground as well.
> Also, for example, there are editors / IDEs who integrate with either one or
> the other or both, or others that chose (or have to) to replicate the
> functionality in order to format the source code properly.
> So then the question is: what should be done to in order to port the imports
> functionality over to gofmt in a way that is acceptable to use by default?
Rob already explained. The gofmt program always act the same way on
all systems and never changes your program behaviour in any way. The
goimports program uses heuristics and will in some cases produce
different results on different systems. Also, because goimports
introduces new imports, it can change your program behaviour.
The only way that the imports functionality will be ported to gofmt
would be if it used no heuristics and always produced exactly the same
results no matter what system it is run on, and if it never changed
your program behaviour in any way. But then, of course, it would be
useless.
There needs to be a tool like gofmt that is 100% reliable and
predictable. Adding goimports functionality to gofmt would break
that.
Ian